diff --git a/aafwk/BUILD.gn b/aafwk/BUILD.gn deleted file mode 100644 index 6caaa7fc8bd77ff6bbf72afe8fc0d81ceb626c02..0000000000000000000000000000000000000000 --- a/aafwk/BUILD.gn +++ /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("//build/ohos_var.gni") - -group("aafwk") { - testonly = true - if (is_standard_system) { - deps = [ "aafwk_standard:aafwk_standard" ] - } -} diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn deleted file mode 100755 index 18fba1ae39ca34cdd42c1a02e4cb9cdde2165a54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/BUILD.gn +++ /dev/null @@ -1,46 +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("//build/ohos_var.gni") - -group("aafwk_standard") { - testonly = true - if (is_standard_system) { - deps = [ - "abilitymanager:actsabilitymanagertest", - "abilitymultiinstance:abilitymultiinstance", - "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", - "actsabilitylifecyclestatenew:ActsAbilityLifecycleStateNewTest", - "actsabilitymanageretstest:ActsAbilityManagerEtsTest", - "actscalltest:actscalltest", - "actsstartcomponenttest:actsstartcomponenttest", - "actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest", - "actsusers:actsusers", - "amscontextualinforquery:amscontextualinforquery", - "amsdatauriutils:ActsAmsDataUriUtilsTest", - "amsdisplayIdtest:amsdisplayIdtest", - "amsgetabilityprocessinfo:amsgetabilityprocessinfo", - "context:context", - "fa:fa", - "featureability:featureability", - "formmanager:formmanager", - "killprocesswithaccountstage:killprocesswithaccountstage", - "newwant:newwant", - "non_concurrent:non_concurrent", - "processmultiinstance:processmultiinstance", - "stage:stage", - "want:want", - "zidltest:zidltest", - ] - } -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json deleted file mode 100644 index 587d73eda9baa9ad187ef6aba15e10f2c8fadad2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamscallbackfifthscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamscallbackfifthscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackfifthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name":"ohos.permission.MANAGE_MISSIONS", - "reason":"need use ohos.permission.MANAGE_MISSIONS" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 7c1e767990428b700b6d26713631145707981a9c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,144 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -let abilityNameList = [ - "com.ohos.launcher.MainAbility", - "com.ohos.callui.ServiceAbility", - "com.example.SimulateFeatureAbilityFir", - "com.example.VerifyIoThirdAbility", - "com.example.SimulateFeatureAbilitySed", - "com.example.actsamscallbackfifthscene.MainAbility" -] - -let bundleNameList = [ - "com.ohos.launcher", - "com.ohos.systemui", - "com.ohos.callui", - "com.ohos.contacts", - "com.ohos.mms", - "com.ohos.telephonydataability", - "com.ohos.contactsdataability", - "com.ix.simulate.feature", - "com.ix.verify.io", - "com.example.actsamscallbackfifthscene" -] - -describe('ActsAmsCallBackFifthScene', function () { - console.info('----ActsAmsCallBackFifthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilitySed", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - setTimeout(done, 5000); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_6600 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_6600', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - } - ); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json deleted file mode 100644 index 93d37f5c92c0122d2cb73a29a6db2ac3c596eb54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamscallbackfirstscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamscallbackfirstscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackfirstscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 5e9e17c9348f517de1cbbeca97f329cf9677c03c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,87 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' - -describe('ActsAmsCallBackFirstScene', function () { - console.info('----ActsAmsCallBackFirstScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_0200 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_0200', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json deleted file mode 100644 index 91ea088ceeba5e02ebd26beb56f0892a0b2172a7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamscallbackfourthscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamscallbackfourthscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackfourthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 8cecdd34071364c51e1a1a52523ba0d76838243c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,138 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsCallBackFourthScene', function () { - console.info('----ActsAmsCallBackFourthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.act", - abilityName: "com.example.VerifyActThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.entry", - abilityName: "com.example.SimulateEntryAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_5000 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_5000', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index d6dd1794b13ff616b84e0421e8db0759c680c4cf..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,104 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' - -describe('ActsAmsCallBackSecondScene', function () { - console.info('----ActsAmsCallBackSecondScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_1800 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_1800', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json deleted file mode 100644 index 5d5e565d90ff227c8c75f0fc81b05eff0002673f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamscallbackthirdscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamscallbackthirdscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackthirdscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index fa89922d593b8736cbd0ca3b57851247122d8f6a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,98 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsCallBackThirdScene', function () { - console.info('----ActsAmsCallBackThirdScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_3400 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_3400', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/config.json deleted file mode 100644 index 93a4f79a2b8f817e1fdaef40e060f3b43eefd6e0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamstestfifthscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamstestfifthscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestfifthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index c6abb03cf8f11545609396232d362a25cbdd4313..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,154 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -let abilityNameList = [ - "com.ohos.launcher.MainAbility", - "com.ohos.callui.ServiceAbility", - "com.example.SimulateFeatureAbilityFir", - "com.example.SimulateFeatureAbilitySed", - "com.example.VerifyIoThirdAbility", - "com.example.actsamstestfifthscene.MainAbility" -] - -let bundleNameList = [ - "com.ohos.launcher", - "com.ohos.systemui", - "com.ohos.callui", - "com.ohos.contacts", - "com.ohos.mms", - "com.ohos.telephonydataability", - "com.ohos.contactsdataability", - "com.ix.simulate.feature", - "com.ix.verify.io", - "com.example.actsamstestfifthscene" -] - -describe('ActsAmsTestFifthScene', function () { - console.info('----ActsAmsTestFifthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilitySed", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_0100 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_0100', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - let info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/config.json deleted file mode 100644 index 2a7d876233c49b6df5c9f5bc3a50797c7b49bde1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/config.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamstestfirstscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamstestfirstscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": "com.example.actsamstestfirstscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 89ea4840831e61ba3c917d483bb0918a1caba6dd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,88 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestFirstScene', function () { - console.info('----ActsAmsTestFirstScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_0100 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_0100', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/config.json deleted file mode 100644 index bd83460fe18ea646108c470c27d5a89cac905339..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamstestfourthscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamstestfourthscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestfourthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 5db5938070dd61cbeef312ded4487cfc9faa4530..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,154 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestFourthScene', function () { - console.info('----ActsAmsTestFourthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.act", - abilityName: "com.example.VerifyActThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.entry", - abilityName: "com.example.SimulateEntryAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_1700 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_1700', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/config.json deleted file mode 100644 index b877c7d21a4e6ce8240807de6033f6d911ea8afc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamstestsecondscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamstestsecondscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestsecondscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 30148309fb0f10aaca15a5528f2788788dc5a3ae..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,110 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestSecondScene', function () { - console.info('----ActsAmsTestSecondScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_1700 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_1700', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/config.json deleted file mode 100644 index bfa361843e1c5e59f83ed22dd68ced2b9db5a2b7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsamstestthirdscene", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsamstestthirdscene", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestthirdscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "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" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index a3775ae39d5a13062873e441d7152b906e20b602..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,112 +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 featureAbility from '@ohos.ability.featureability' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestThirdScene', function () { - console.info('----ActsAmsTestThirdScene----'); - - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_3300 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_3300', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info)); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); - expect(typeof (info[i].pid)).assertEqual("number"); - expect(info[i].pid).assertLarger(0); - - expect(typeof (info[i].processName)).assertEqual("string"); - expect(info[i].processName.length).assertLarger(0); - expect(Array.isArray(info[i].bundleNames)).assertEqual(true); - expect(info[i].bundleNames.length).assertEqual(0); - - expect(typeof (info[i].uid)).assertEqual("number"); - expect(info[i].uid).assertLarger(0); - } - done(); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/config.json deleted file mode 100644 index 863cea8c0d2beb9916eacc1e9bf602f5a4c2ce9b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "bundleName": "com.ix.simulate.entry", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.simulateeability", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "simulateEAbility", - "moduleType": "feature", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.SimulateEntryAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json deleted file mode 100644 index ba0166b87a7e0e550e0c56d4d117e37ce147537a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "bundleName": "com.ix.simulate.feature", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.simulatefabilityfir", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "simulateFAbilityFir", - "moduleType": "feature", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.SimulateFeatureAbilityFir", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json deleted file mode 100644 index 19d4fdde572a057d21418b89b5f705260141557d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "bundleName": "com.ix.simulate.feature", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.simulatefabilitysed", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "simulateFAbilitySed", - "moduleType": "feature", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.SimulateFeatureAbilitySed", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/config.json deleted file mode 100644 index 101baeb978f8f09baf374e7397cb886f7d49c857..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "bundleName": "com.ix.verify.act", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.verifyaability", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "verifyAAbility", - "moduleType": "feature", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.VerifyActThirdAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/config.json deleted file mode 100644 index 657b60b37733030913c3bdaf3df3eeb946919ebf..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "bundleName": "com.ix.verify.io", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.verifyiability", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "verifyIAbility", - "moduleType": "feature", - "installationFree": true - }, - "abilities": [ - { - "visible": true, - "name": "com.example.VerifyIoThirdAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "singleton" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.css deleted file mode 100755 index caf729946975b79e55ab9e56e55bf860337b3f50..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.hml deleted file mode 100755 index 61ea59d936e5a2971f1ea3d179c44a7f3f596c54..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,21 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{title}} - - -
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/element/string.json deleted file mode 100755 index f94ce7e64e455e1ebf22a4b2792c5b52c791d037..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/app.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/app.json deleted file mode 100755 index d67e483bd8ea4508e24f2157b4ee6d92f6f44f9e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.amsabilitymultiinstanceappa", - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/Test.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 3e374f11969c3fdeeddb1b3ab50e70f68cae2ab2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,51 +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" - -const ONACCEPTWANT_KEY_NOTSET_ID = -1; -const ONACCEPTWANT_KEY_UNDEFINED_ID = -2; -var onAcceptWantCalledSeq; - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("AbilityMultiInstanceAppA MyAbilityStage onCreate") - globalThis.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } - - onAcceptWant(want) { - console.log("AbilityMultiInstanceAppA onAcceptWant called want:" + JSON.stringify(want)); - if ((want.parameters == undefined) || (want.parameters.startId == undefined)) { - console.log("AbilityMultiInstanceAppA specified param err"); - return; - } - - var abilityId = want.parameters.startId.toString(); - onAcceptWantCalledSeq = "onAcceptWantCalled"; - onAcceptWantCalledSeq += "Id"; - onAcceptWantCalledSeq += abilityId; - globalThis.onAcceptWantCalledSeq = onAcceptWantCalledSeq; - - if (want.parameters.startId == ONACCEPTWANT_KEY_NOTSET_ID) { - return; - } else if (want.parameters.startId == ONACCEPTWANT_KEY_UNDEFINED_ID) { - return undefined; - } - - globalThis.abilityWant = want; - console.log("AbilityMultiInstanceAppA set globalThis result :" + globalThis.onAcceptWantCalledSeq); - return abilityId; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 43ebe70e0abfcc5d265325b52b996c58833a27f8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,141 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; - -function publishCallBack() { - console.debug("====>Publish CallBack ====>"); -} - -async function startAbilityProcess(abilityContext, parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - case "StartE": - bundleName = "com.example.amsabilitymultiinstanceappe"; - abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - }, (error, data) => { - console.log('AppA startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "AppA:" - callBackSeq += globalThis.onAcceptWantCalledSeq; - callBackData += callBackSeq; - - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - - console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify(abilityWant)); - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - callBackSeq = ""; - globalThis.onAcceptWantCalledSeq = ""; - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - callBackSeq = ""; - globalThis.onAcceptWantCalledSeq = ""; - startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); - }); - } -} - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceAppA onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceAppA onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceAppA onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceAppA onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceAppA onForeground") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceAppA onBackground") - } -}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json deleted file mode 100755 index 1295ce09e65bf8a693bbf550e26b6410572c0c0e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "module": { - "name": "com.example.amsabilitymultiinstanceappa", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.amsabilitymultiinstanceappa.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "launchType": "specified", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/app.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/app.json deleted file mode 100755 index 3a8cafbace72ac1e99151ff1e395f5c6aac4c39e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.amsabilitymultiinstanceappb", - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/Test.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index f85fcf92b35787bd01eb2edb753cdd6b49f1dfdd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 6079a2ac35659177d9c87a847b92bdd1527ddbd5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,137 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; - -function publishCallBack() { - console.debug("====>AbilityMultiInstanceAppB Publish CallBack ====>"); -} - -async function startAbilityProcess(abilityContext, parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - case "StartE": - bundleName = "com.example.amsabilitymultiinstanceappe"; - abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - }, (error, data) => { - console.log('AppB startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "AppB:" - callBackData += callBackSeq; - - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - console.log("AbilityMultiInstanceAppB onShowProcess") - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - callBackSeq = ""; - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - callBackSeq = ""; - startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); - }); - } -} - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceAppB MainAbility onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceAppB MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceAppB MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceAppB MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceAppB MainAbility onForeground") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceAppB MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json deleted file mode 100755 index 75e3babd5c72d3676c2316809129459391ab8ad5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "module": { - "name": "com.example.amsabilitymultiinstanceappb", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.amsabilitymultiinstanceappb.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "launchType": "standard", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/app.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/app.json deleted file mode 100755 index 9aba063149e11de782e342d6dfbee9c7e76bc7f8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.amsabilitymultiinstanceappc", - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/Test.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index f85fcf92b35787bd01eb2edb753cdd6b49f1dfdd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 51045c97e81fb6c20dcb2cd996045caf767ad1ba..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,135 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; - -function publishCallBack() { - console.debug("====>AbilityMultiInstanceAppC Publish CallBack ====>"); -} - -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "AppC:"; - callBackData += callBackSeq; - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - console.log("AbilityMultiInstanceAppC onShowProcess") - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); - }); - } - callBackSeq = ""; -} - -async function startAbilityProcess(abilityContext, parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - case "StartE": - bundleName = "com.example.amsabilitymultiinstanceappe"; - abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - }, (error, data) => { - console.log('AppC startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context - 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") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json deleted file mode 100755 index e057d556016f87d67feeb1d75387d9e662e7cfae..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "module": { - "name": "com.example.amsabilitymultiinstanceappc", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.amsabilitymultiinstanceappc.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "launchType": "singleton", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/app.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/app.json deleted file mode 100755 index 8392e22811fde0f13b8db0baa00eabbb9a86b371..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.amsabilitymultiinstanceappd", - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/Test.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 89ebbd7d62a810f034fc4bea4517987e8af21e7e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,37 +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" - -var onAcceptWantCalledSeq; - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("AbilityMultiInstanceAppD MyAbilityStage onCreate") - globalThis.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } - - onAcceptWant(want) { - console.log("AbilityMultiInstanceAppD onAcceptWant called want:" + JSON.stringify(want)); - var abilityId = want.parameters.startId.toString(); - onAcceptWantCalledSeq = "onAcceptWantCalled"; - onAcceptWantCalledSeq += "Id"; - onAcceptWantCalledSeq += abilityId; - globalThis.onAcceptWantCalledSeq = onAcceptWantCalledSeq; - globalThis.abilityWant = want; - console.log("AbilityMultiInstanceAppD set globalThis result :" + globalThis.onAcceptWantCalledSeq); - return abilityId; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 8576046e9fd231d301d8fd0d5fedf701c1517161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,137 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; -function publishCallBack() { - console.debug("====>AbilityMultiInstanceAppD Publish CallBack ====>"); -} -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "AppD:"; - callBackSeq += globalThis.onAcceptWantCalledSeq; - callBackData += callBackSeq; - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - - console.log("AbilityMultiInstanceAppD abilityWant = " + JSON.stringify(abilityWant)); - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); - }); - } - globalThis.onAcceptWantCalledSeq = ""; - callBackSeq = ""; -} - -async function startAbilityProcess(abilityContext, parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - case "StartE": - bundleName = "com.example.amsabilitymultiinstanceappe"; - abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - }, (error, data) => { - console.log('AppD startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceAppD onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceAppD onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceAppD onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceAppD onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceAppD onForeground") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceAppD onBackground") - } -}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/SecondAbility/SecondAbility.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/SecondAbility/SecondAbility.ts deleted file mode 100755 index 1542e0cadfc1a69dbcd3d33facbd7719fe0f8b01..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ /dev/null @@ -1,137 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; -function publishCallBack() { - console.debug("====>AbilityMultiInstanceAppD Sec Publish CallBack ====>"); -} -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "AppD:"; - callBackSeq += globalThis.onAcceptWantCalledSeq; - callBackData += callBackSeq; - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - - console.log("AbilityMultiInstanceAppD Sec abilityWant = " + JSON.stringify(abilityWant)); - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); - }); - } - globalThis.onAcceptWantCalledSeq = ""; - callBackSeq = ""; -} - -async function startAbilityProcess(abilityContext, parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - case "StartE": - bundleName = "com.example.amsabilitymultiinstanceappe"; - abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - }, (error, data) => { - console.log('AppD startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -export default class SecondAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceAppD Sec onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceAppD Sec onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceAppD Sec onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceAppD Sec onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceAppD Sec onForeground") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceAppD Sec onBackground") - } -}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/ThirdAbility/ThirdAbility.ts deleted file mode 100755 index 1e9537a68caab6f135948932743a082f1a4185f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/ThirdAbility/ThirdAbility.ts +++ /dev/null @@ -1,133 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; -function publishCallBack() { - console.debug("====>AbilityMultiInstanceAppD Third Publish CallBack ====>"); -} -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "AppD:"; - callBackSeq += globalThis.onAcceptWantCalledSeq; - callBackData += callBackSeq; - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - - console.log("AbilityMultiInstanceAppD Third abilityWant = " + JSON.stringify(abilityWant)); - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); - }); - } - globalThis.onAcceptWantCalledSeq = ""; - callBackSeq = ""; -} - -async function startAbilityProcess(abilityContext, parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - }, (error, data) => { - console.log('AppD startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -export default class ThirdAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceAppD Third onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceAppD Third onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceAppD Third onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceAppD Third onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceAppD Third onForeground") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceAppD Third onBackground") - } -}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json deleted file mode 100755 index 87d984d906258e6f231e0818890387a07bd840a3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "module": { - "name": "com.example.amsabilitymultiinstanceappd", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.amsabilitymultiinstanceappd.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "launchType": "specified", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - }, - { - "name": "com.example.amsabilitymultiinstanceappd.SecondAbility", - "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "launchType": "standard", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - }, - { - "name": "com.example.amsabilitymultiinstanceappd.ThirdAbility", - "srcEntrance": "./ets/ThirdAbility/ThirdAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "launchType": "singleton", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.js deleted file mode 100755 index 3bd0d8acc929c7f56fb5b681260878986342a90e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,120 +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 featureAbility from '@ohos.ability.featureability' -import commonEvent from '@ohos.commonEvent' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -var callBackSeq = ""; - -function publishCallBack() { - console.debug("====>AbilityMultiInstanceAppB Publish CallBack ====>"); -} - -async function startAbilityProcess(parameters) { - let bundleName = "com.example.amsabilitymultiinstanceappa"; - let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "StartA1": - parameters.startId = 1; - break; - case "StartA2": - parameters.startId = 2; - break; - case "StartB": - bundleName = "com.example.amsabilitymultiinstanceappb"; - abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; - break; - case "StartC": - bundleName = "com.example.amsabilitymultiinstanceappc"; - abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; - break; - case "StartDMain1": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 1; - break; - case "StartDMain2": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; - parameters.startId = 2; - break; - case "StartDSec": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; - break; - case "StartDThd": - bundleName = "com.example.amsabilitymultiinstanceappd"; - abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; - break; - case "StartE": - bundleName = "com.example.amsabilitymultiinstanceappe"; - abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; - break; - - default: - break; - } - parameters.nextStep = ++idx; - await featureAbility.startAbility({ - want: - { - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - } - }); -} - -async function onShowProcess() { - var abilityWant = await featureAbility.getWant(); - var callBackData = "AppE:"; - callBackData += callBackSeq; - var commonEventPublishData = { - data: callBackData, - parameters: abilityWant.parameters - }; - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - startAbilityProcess(abilityWant.parameters); - }); - } - callBackSeq = ""; -} - -export default { - data: { - title: "AbilityMultiInstanceAppE" - }, - onInit() { - this.title = "AbilityMultiInstanceAppE"; - callBackSeq += "onInit"; - }, - onShow() { - console.log('AbilityMultiInstanceAppE onShow start'); - callBackSeq += "onShow"; - onShowProcess(); - }, - onStart() { - console.log('AbilityMultiInstanceAppE onStart'); - }, - onStop() { - console.log('AbilityMultiInstanceAppE onStop'); - }, -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/Test.json b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/Test.json deleted file mode 100755 index f3c05f6cac44b4e1392bd7de9359f572e107fef2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/Test.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.example.abilitymultiinstance", - "shell-timeout": "300000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAmsAbilityMultiinstanceTest.hap", - "ActsAmsAbilityMultiinstanceHapARelyHap.hap", - "ActsAmsAbilityMultiinstanceHapBRelyHap.hap", - "ActsAmsAbilityMultiinstanceHapCRelyHap.hap", - "ActsAmsAbilityMultiinstanceHapDRelyHap.hap", - "ActsAmsAbilityMultiinstanceHapERelyHap.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 644 /data/*.hap" - ] - } - ] -} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index.ets b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index.ets deleted file mode 100755 index e5ef3e3680a267a6aa28a510c77f04cc5cd3c0cb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index.ets +++ /dev/null @@ -1,64 +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.ets" -import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters['timeout'] = 10000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Test App') - .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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/BUILD.gn b/aafwk/aafwk_standard/actsabilitymanageretstest/BUILD.gn deleted file mode 100644 index 082b2b6c6fe264af9abe979ca351d85405c63ac5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/BUILD.gn +++ /dev/null @@ -1,36 +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("ActsAbilityManagerEtsTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_ets_assets", - ":hjs_demo_ets_resources", - ":hjs_demo_ets_test_assets", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAbilityManagerEtsTest" -} -ohos_js_assets("hjs_demo_ets_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_js_assets("hjs_demo_ets_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" -} -ohos_resources("hjs_demo_ets_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/Test.json b/aafwk/aafwk_standard/actsabilitymanageretstest/Test.json deleted file mode 100644 index 612f4ad6cde7edc8136b76da944ac6447854c819..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for aceceshi Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "600000", - "bundle-name": "com.ohos.acecollaboration", - "package-name": "com.ohos.acecollaboration", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAbilityManagerEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json deleted file mode 100644 index 9ce6b05e5656e00bc860a908d1972996c074a95f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.acecollaboration", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.acecollaboration", - "name": ".MyApplication", - "srcPath": "", - "mainAbility": "com.ohos.acecollaboration.MainAbility", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "srcPath": "MainAbility", - "srcLanguage": "ets", - "name": "com.ohos.acecollaboration.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "srcPath": "MainAbility2", - "name": ".MainAbility2", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability2", - "formsEnabled": false, - "label": "$string:entry_MainAbility2", - "type": "page", - "launchType": "standard" - }, - { - "srcPath": "ServiceAbility", - "name": ".ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability", - "type": "service" - }, - { - "srcPath": "ServiceAbility2", - "name": ".ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability2", - "type": "service" - }, - { - "srcPath": "ServiceAbility3", - "name": ".ServiceAbility3", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability3", - "type": "service" - }, - { - "srcPath": "ServiceAbility4", - "name": ".ServiceAbility4", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability4", - "type": "service" - }, - { - "srcPath": "ServiceAbility5", - "name": ".ServiceAbility5", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability5", - "type": "service" - }, - { - "srcPath": "ServiceAbility6", - "name": ".ServiceAbility6", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability6", - "type": "service" - }, - { - "srcPath": "ServiceAbility7", - "name": ".ServiceAbility7", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:description_serviceability7", - "type": "service" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": "MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility2", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "name": "com.ohos.acecollaboration.DataAbilityShellProvider.PROVIDER" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 5d603333c7bf5167e7d1d3ead6c9daa9c4b2862d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 5b8a8cc1e2e6b3499fd9192331356dbb7300b9f8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,40 +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. - */ - -@Entry -@Component -struct MyComponent { - aboutToAppear() { - } - - 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') - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts deleted file mode 100644 index bc342fe3466309a38caac4ed30aff68f3d01738b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts +++ /dev/null @@ -1,52 +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 rpc from '@ohos.rpc'; - -class StubTest extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility op1:' + op1 + ' op2:' + op2); - } - return true; - } -} - -export default { - onStart() { - console.info('ServiceAbility onStart'); - }, - onStop() { - console.info('ServiceAbility onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility onCommand'); - }, - onConnect(want) { - console.info('ServiceAbility onConnect'); - return new StubTest("test"); - }, - onDisConnect(want) { - console.info('ServiceAbility onDisConnect'); - }, -}; diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts deleted file mode 100644 index fb96c3af10db275c6eb3707f198e1fa30e014e3d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts +++ /dev/null @@ -1,132 +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 particleAbility from '@ohos.ability.particleAbility'; -import rpc from '@ohos.rpc' - -class StubTest2 extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility2 onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility2 op1:' + op1 + ' op2:' + op2); - } - return true; - } -} - -function getNowTime() { - return new Date().getTime(); -} - -function getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; -} - -async function sleep(time: any) { - var now = new Date(); - var exitTime = now.getTime() + time; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - break; - } - console.info(`sleep ${time} over...`); -} - -export default { - onStart() { - console.info('ServiceAbility2 onStart'); - }, - onStop() { - console.info('ServiceAbility2 onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility2 onCommand'); - let request = { - "bundleName": "com.ohos.acecollaboration", - "abilityName": "com.ohos.acecollaboration.ServiceAbility", - } - let options = { - onConnect: async function (element: any, proxy: any) { - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.deviceId : ' - + JSON.stringify(element.deviceId)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.bundleName : ' - + JSON.stringify(element.bundleName)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.abilityName : ' - + JSON.stringify(element.abilityName)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.uri : ' - + JSON.stringify(element.uri)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.shortName : ' - + JSON.stringify(element.shortName)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect proxy : ' - + JSON.stringify(proxy)); - }, - onDisconnect: async function (element1: any) { - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.deviceId : ' - + JSON.stringify(element1.deviceId)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.bundleName : ' - + JSON.stringify(element1.bundleName)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.abilityName: ' - + JSON.stringify(element1.abilityName)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.uri : ' - + JSON.stringify(element1.uri)); - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.shortName : ' - + JSON.stringify(element1.shortName)); - }, - onFailed: async function (code: any) { - console.log('particleAbility_connectAbility_test_0100 ConnectAbility onFailed errCode : ' + code); - }, - } - - let connection_succeeded: any; - console.info('particleAbility_connectAbility_test_0100 start '); - var timeOldStamp = getNowTime(); - var connection = particleAbility.connectAbility(request, options); - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0100 connectability', timeOldStamp, timeNewStamp); - connection_succeeded = connection; - console.info('particleAbility_connectAbility_test_0100 service request is:' + JSON.stringify(request)); - console.info('particleAbility_connectAbility_test_0100 options is:' + JSON.stringify(options)); - console.info('particleAbility_connectAbility_test_0100 data is: ' + JSON.stringify(connection)); - console.info('particleAbility_connectAbility_test_0100 connection=: ' + connection); - sleep(5000); - console.info('particleAbility_connectAbility_test_0100 disconnectability start '); - var timeOldStamp = getNowTime(); - particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0100 disconnectability', timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0100 disconnectability succeeded: ' + - JSON.stringify(data)); - }).catch((error: any) => { - console.error('particleAbility_connectAbility_test_0100 disconnectability failed. Cause: ' + - JSON.stringify(error)); - }) - }, - onConnect(want) { - console.info('ServiceAbility2 onConnect'); - return new StubTest2("test"); - }, -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts deleted file mode 100644 index 4c669dfbde479acb547c1480690f4a21f5cbb10d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts +++ /dev/null @@ -1,133 +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 particleAbility from '@ohos.ability.particleAbility'; -import rpc from '@ohos.rpc'; - -class StubTest3 extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility3 onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility3 op1:' + op1 + ' op2:' + op2); - } - return true; - } -} - -function getNowTime() { - return new Date().getTime(); -} - -function getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; -} - -async function sleep(time: any) { - var now = new Date(); - var exitTime = now.getTime() + time; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - break; - } - console.info(`sleep ${time} over...`); -} - -export default { - onStart() { - console.info('ServiceAbility3 onStart'); - }, - onStop() { - console.info('ServiceAbility3 onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility3 onCommand'); - let request = { - "bundleName": "com.ohos.acecollaboration", - "abilityName": "com.ohos.acecollaboration.ServiceAbility", - } - let options = { - onConnect: async function (element: any, proxy: any) { - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.deviceId : ' - + JSON.stringify(element.deviceId)) - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.bundleName : ' - + JSON.stringify(element.bundleName)) - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.abilityName : ' - + JSON.stringify(element.abilityName)) - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.uri : ' - + JSON.stringify(element.uri)) - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.shortName : ' - + JSON.stringify(element.shortName)) - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect proxy : ' - + JSON.stringify(proxy)); - }, - onDisconnect: async function (element1: any) { - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.deviceId :' - + JSON.stringify(element1.deviceId)); - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.bundleName :' - + JSON.stringify(element1.bundleName)); - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.abilityName :' - + JSON.stringify(element1.abilityName)); - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.uri : ' - + JSON.stringify(element1.uri)); - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.shortName : ' - + JSON.stringify(element1.shortName)); - }, - onFailed: function (code: any) { - console.log('particleAbility_connectAbility_test_0200 ConnectAbility onFailed errCode: ' + code) - }, - } - - let connection_succeeded: any; - console.info('particleAbility_connectAbility_test_0200 start '); - var timeOldStamp = getNowTime(); - var connection = particleAbility.connectAbility(request, options); - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0200 connectability', timeOldStamp, timeNewStamp); - connection_succeeded = connection; - console.info('particleAbility_connectAbility_test_0200 service request is:' + JSON.stringify(request)); - console.info('particleAbility_connectAbility_test_0200 options is:' + JSON.stringify(options)); - console.info('particleAbility_connectAbility_test_0200 connection=: ' + connection); - sleep(5000); - console.info('particleAbility_connectAbility_test_0200 disconnectability start '); - try { - var timeOldStamp = getNowTime(); - particleAbility.disconnectAbility(connection_succeeded, (error, data) => { - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0200 disconnectability', timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0200 disconnectability succeeded: ' + JSON.stringify(data)); - }) - } - catch(error: any){ - console.error('particleAbility_connectAbility_test_0200 disconnectability failed. Cause: ' + - JSON.stringify(error)); - } - }, - onConnect(want) { - console.info('ServiceAbility3 onConnect'); - return new StubTest3("test"); - }, -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts deleted file mode 100644 index 8b768feb66951e0b3be14938b1f24f3bc08d3fef..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts +++ /dev/null @@ -1,132 +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 particleAbility from '@ohos.ability.particleAbility'; -import rpc from '@ohos.rpc' - -class StubTest4 extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility4 onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility4 op1:' + op1 + ' op2:' + op2); - } - return true; - } -} - -function getNowTime() { - return new Date().getTime(); -} - -function getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; -} - -async function sleep(time: any) { - var now = new Date(); - var exitTime = now.getTime() + time; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - break; - } - console.info(`sleep ${time} over...`); -} - -export default { - onStart() { - console.info('ServiceAbility4 onStart'); - }, - onStop() { - console.info('ServiceAbility4 onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility4 onCommand'); - let request = { - "bundleName": "com.open.harmony.packagemag", - "abilityName": "com.open.harmony.packagemag.packServiceAbility", - } - let options = { - onConnect: async function (element: any, proxy: any) { - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.deviceId : ' - + JSON.stringify(element.deviceId)) - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.bundleName : ' - + JSON.stringify(element.bundleName)) - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.abilityName : ' - + JSON.stringify(element.abilityName)) - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.uri : ' - + JSON.stringify(element.uri)) - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.shortName : ' - + JSON.stringify(element.shortName)) - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect proxy : ' - + JSON.stringify(proxy)); - }, - onDisconnect: async function (element1: any) { - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.deviceId : ' - + JSON.stringify(element1.deviceId)); - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.bundleName: ' - + JSON.stringify(element1.bundleName)); - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.abilityName:' - + JSON.stringify(element1.abilityName)); - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.uri: ' - + JSON.stringify(element1.uri)); - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.shortName :' - + JSON.stringify(element1.shortName)); - }, - onFailed: function (code: any) { - console.log('particleAbility_connectAbility_test_0300 ConnectAbility onFailed errCode : '+ code); - }, - } - - let connection_succeeded: any; - console.info('particleAbility_connectAbility_test_0300 start '); - var timeOldStamp = getNowTime(); - var connection = particleAbility.connectAbility(request, options); - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0300 connectability', timeOldStamp, timeNewStamp); - connection_succeeded = connection; - console.info('particleAbility_connectAbility_test_0300 service request is:' + JSON.stringify(request)); - console.info('particleAbility_connectAbility_test_0300 options is:' + JSON.stringify(options)); - console.info('particleAbility_connectAbility_test_0300 data is: ' + JSON.stringify(connection)); - console.info('particleAbility_connectAbility_test_0300 connection=: ' + connection); - sleep(5000); - console.info('particleAbility_connectAbility_test_0300 disconnectability start '); - var timeOldStamp = getNowTime(); - particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0300 disconnectability', timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0300 disconnectability succeeded:' - + JSON.stringify(data)); - }).catch ((error: any) =>{ - console.error('particleAbility_connectAbility_test_0300 disconnectability failed. Cause: ' + - JSON.stringify(error)); - }) - }, - onConnect(want) { - console.info('ServiceAbility4 onConnect'); - return new StubTest4("test"); - }, -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts deleted file mode 100644 index 646eb606b02d7cee6f934271853de8f8449f44fb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts +++ /dev/null @@ -1,147 +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 particleAbility from '@ohos.ability.particleAbility'; -import rpc from '@ohos.rpc' - -class StubTest5 extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility5 onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility5 op1:' + op1 + ' op2:' + op2); - } - return true; - } -} - -function getNowTime() { - return new Date().getTime(); -} - -function getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; -} - -async function sleep(time: any) { - var now = new Date(); - var exitTime = now.getTime() + time; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - break; - } - console.info(`sleep ${time} over...`); -} - -export default { - onStart() { - console.info('ServiceAbility5 onStart'); - }, - onStop() { - console.info('ServiceAbility5 onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility5 onCommand'); - let request = { - "bundleName": "", - "abilityName": "", - } - let options = { - onConnect: async function (element: any, proxy: any) { - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.deviceId : ' - + JSON.stringify(element.deviceId)) - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.bundleName : ' - + JSON.stringify(element.bundleName)) - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.abilityName : ' - + JSON.stringify(element.abilityName)) - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.uri : ' - + JSON.stringify(element.uri)) - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.shortName : ' - + JSON.stringify(element.shortName)) - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect proxy : ' - + JSON.stringify(proxy)); - }, - onDisconnect: function (element1: any) { - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.deviceId : ' - + JSON.stringify(element1.deviceId)); - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.bundleName: ' - + JSON.stringify(element1.bundleName)); - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.abilityName:' - + JSON.stringify(element1.abilityName)); - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.uri : ' - + JSON.stringify(element1.uri)); - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.shortName : ' - + JSON.stringify(element1.shortName)); - }, - onFailed: function (code: any) { - console.log('particleAbility_connectAbility_test_0400 ConnectAbility onFailed errCode:' + code); - }, - } - - let connection_succeeded: any; - console.info('particleAbility_connectAbility_test_0400 start '); - var timeOldStamp = getNowTime(); - var connection = particleAbility.connectAbility(request, options); - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0400 connectability', timeOldStamp, timeNewStamp); - connection_succeeded = connection; - console.info('particleAbility_connectAbility_test_0400 service request is:' + JSON.stringify(request)); - console.info('particleAbility_connectAbility_test_0400 options is:' + JSON.stringify(options)); - console.info('particleAbility_connectAbility_test_0400 connection=: ' + connection); - sleep(5000); - console.info('particleAbility_connectAbility_test_0400 disconnectability start '); - var timeOldStamp = getNowTime(); - particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0400 disconnectability', timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0400 disconnectability succeeded: ' + - JSON.stringify(data)); - }).catch((error: any) => { - console.error('particleAbility_connectAbility_test_0400 disconnectability failed. Cause: ' + - JSON.stringify(error)); - }); - sleep(5000); - console.info('particleAbility_connectAbility_test_0400 disconnectability_fail start '); - try { - var timeOldStamp = getNowTime(); - particleAbility.disconnectAbility(-1).then((data: any) => { - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0400 disconnectability_fail', - timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0400 disconnectability_fail succeeded: ' + - JSON.stringify(data)); - }) - } - catch (error: any) { - console.error('particleAbility_connectAbility_test_0400 disconnectability_fail failed. Cause: ' + - JSON.stringify(error)); - } - }, - onConnect(want) { - console.info('ServiceAbility5 onConnect'); - return new StubTest5("test"); - }, -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts deleted file mode 100644 index 5e5f15eb7146d35bd26b6c5512a94991b08f5b68..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts +++ /dev/null @@ -1,108 +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 particleAbility from '@ohos.ability.particleAbility'; -import rpc from '@ohos.rpc' - -class StubTest6 extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility6 onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility6 op1:' + op1 + ' op2:' + op2); - } - return true; - } -} -function getNowTime() { - return new Date().getTime(); -} - -function getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; -} - -export default { - onStart() { - console.info('ServiceAbility onStart'); - }, - onStop() { - console.info('ServiceAbility onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility onCommand'); - - let request = { - "bundleName":"com.ohos.acecollaboration", - "abilityName":"com.ohos.acecollaboration.xxx", - } - let options = { - onConnect:async function (element:any, proxy:any) { - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.deviceId : ' - + JSON.stringify(element.deviceId)) - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.bundleName : ' - + JSON.stringify(element.bundleName)) - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.abilityName : ' - + JSON.stringify(element.abilityName)) - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.uri : ' - + JSON.stringify(element.uri)) - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.shortName : ' - + JSON.stringify(element.shortName)) - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect proxy : ' - + JSON.stringify(proxy)); - }, - onDisconnect:function (element1:any) { - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.deviceId : ' - + JSON.stringify(element1.deviceId)); - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.bundleName: ' - + JSON.stringify(element1.bundleName)); - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.abilityName:' - + JSON.stringify(element1.abilityName)); - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.uri : ' - + JSON.stringify(element1.uri)); - console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.shortName : ' - + JSON.stringify(element1.shortName)); - }, - onFailed:function (code:any) { - console.log('particleAbility_connectAbility_test_0500 ConnectAbility service onFailed errCode:' + code) - }, - } - - console.info('particleAbility_connectAbility_test_0500 errorabilityName start'); - var timeOldStamp = getNowTime(); - var connection = particleAbility.connectAbility(request, options); - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0500 connectability', timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0500 errorabilityName request is:' - + JSON.stringify(request)); - console.info('particleAbility_connectAbility_test_0500 errorabilityName options is:' - + JSON.stringify(options)); - console.info('particleAbility_connectAbility_test_0500 errorabilityName connection=: ' + connection); - }, - onConnect(want) { - console.info('ServiceAbility6 onConnect'); - return new StubTest6("test"); - }, -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts deleted file mode 100644 index a1efccb5cf6eeab2eb90e6b589958c139599e0ae..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts +++ /dev/null @@ -1,135 +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 particleAbility from '@ohos.ability.particleAbility'; -import rpc from '@ohos.rpc' - -class StubTest7 extends rpc.RemoteObject { - constructor(des) { - super(des) - } - - onRemoteRequest(code, data, reply, option) { - console.info('ServiceAbility7 onRemoteRequest'); - if (code === 1) { - let op1 = data.readInt(); - let op2 = data.readInt(); - reply.writeInt(op1 + op2); - console.info('ServiceAbility7 op1:' + op1 + ' op2:' + op2); - } - return true; - } -} - -function getNowTime() { - return new Date().getTime(); -} - -function getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; -} - -async function sleep(time: any) { - var now = new Date(); - var exitTime = now.getTime() + time; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - break; - } - console.info(`sleep ${time} over...`); -} -export default { - onStart() { - console.info('ServiceAbility7 onStart'); - }, - onStop() { - console.info('ServiceAbility7 onStop'); - }, - onCommand(want, startId) { - console.info('ServiceAbility7 onCommand'); - - let request = { - "bundleName":"com.example.myapplication", - "abilityName":"com.example.myapplication.ServiceAbility_API8", - } - let options = { - onConnect:async function (element:any, proxy:any) { - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.deviceId : ' - + JSON.stringify(element.deviceId)) - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.bundleName : ' - + JSON.stringify(element.bundleName)) - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.abilityName : ' - + JSON.stringify(element.abilityName)) - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.uri : ' - + JSON.stringify(element.uri)) - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.shortName : ' - + JSON.stringify(element.shortName)) - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect proxy : ' - + JSON.stringify(proxy)); - }, - onDisconnect:async function (element1:any) { - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.deviceId : ' - + JSON.stringify(element1.deviceId)); - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.bundleName: ' - + JSON.stringify(element1.bundleName)); - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.abilityName:' - + JSON.stringify(element1.abilityName)); - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.uri : ' - + JSON.stringify(element1.uri)); - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.shortName : ' - + JSON.stringify(element1.shortName)); - }, - onFailed:function (code:any) { - console.log('particleAbility_connectAbility_test_0600 ConnectAbility onFailed errCode:' + code); - }, - } - - let connection_succeeded:any; - console.info('particleAbility_connectAbility_test_0600 start '); - var timeOldStamp = getNowTime(); - var connection = particleAbility.connectAbility(request, options); - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0600 connectability', timeOldStamp, timeNewStamp); - connection_succeeded = connection; - console.info('particleAbility_connectAbility_test_0600 service request is:' + JSON.stringify(request)); - console.info('particleAbility_connectAbility_test_0600 options is:' + JSON.stringify(options)); - console.info('particleAbility_connectAbility_test_0600 data is: ' + JSON.stringify(connection)); - console.info('particleAbility_connectAbility_test_0600 connection=: ' + connection); - sleep(5000); - console.info('particleAbility_connectAbility_test_0600 disconnectability start '); - var timeOldStamp = getNowTime(); - particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { - var timeNewStamp = getNowTime(); - getDurationTime('particleAbility_connectAbility_test_0600 disconnectability', timeOldStamp, timeNewStamp); - console.info('particleAbility_connectAbility_test_0600 disconnectability succeeded: ' + - JSON.stringify(data)); - }).catch((error: any) =>{ - console.error('particleAbility_connectAbility_test_0600 disconnectability failed. Cause: ' + - JSON.stringify(error)); - }); - }, - onConnect(want) { - console.info('ServiceAbility7 onConnect'); - return new StubTest7("test"); - }, - onDisConnect(want) { - console.info('ServiceAbility7 onDisConnect'); - }, -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestAbility/app.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index 9511bef9a9463a9b72db92a826b1d58313ddfe78..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,32 +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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets deleted file mode 100644 index 011878f2b989ed0798baafed2b6c14e241fad57e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets +++ /dev/null @@ -1,49 +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 Index { - aboutToAppear() { - console.info('TestAbility index aboutToAppear') - } - - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 143e3ae5ce3c4181c0034fa6aa3c75191a6c49e6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,77 +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 itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - 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') - } - - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -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 call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) - console.info('OpenHarmonyTestRunner onRun end') - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets deleted file mode 100644 index 94cef5f883debf66714233de4ece8c44cb78eb92..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets +++ /dev/null @@ -1,249 +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 featureAbility from '@ohos.ability.featureAbility' -import {describe, beforeEach, afterEach, it, expect} from 'hypium/index'; -import Utils from './Utils'; - -export default function ContextJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("context before each called"); - done() - }); - - afterEach(async function () { - await Utils.sleep(2000); - console.info("context after each called"); - }); - - /* - * @tc.number: context_getCacheDir_test_0100 - * @tc.name: getCacheDir : Obtains the Cache directory on internal storage. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it("context_getCacheDir_test_0100", 0, async function (done) { - console.log("------------------start context_getCacheDir_test_0100-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getCacheDir().then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getCacheDir_test_0100', timeOldStamp, timeNewStamp) - console.log("context_getCacheDir_test_0100: CacheDir is " + data); - }) - } catch (error) { - console.log("logMessage context_getCacheDir_test_0100: error = " + error); - expect(error).assertEqual("/data/storage/el2/base/haps/entry/cache"); - } - var data1 = await context.getCacheDir(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("/data/storage/el2/base/haps/entry/cache"); - done(); - console.log("------------------end context_getCacheDir_test_0100-------------------"); - }); - - /* - * @tc.number: context_getCacheDir_test_0200 - * @tc.name: getCacheDir : Obtains the Cache directory on internal storage. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it("context_getCacheDir_test_0200", 0, async function (done) { - console.log("------------------start context_getCacheDir_test_0200-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getCacheDir((err, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getCacheDir_test_0200', timeOldStamp, timeNewStamp) - console.log("context_getCacheDir_test_0200: getCacheDir successful, result = " + data); - }); - } catch (error) { - console.log("logMessage context_getCacheDir_test_0200: error = " + error); - expect(error).assertEqual("/data/storage/el2/base/haps/entry/cache"); - } - var data1 = await context.getCacheDir(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("/data/storage/el2/base/haps/entry/cache"); - done(); - console.log("------------------end context_getCacheDir_test_0200-------------------"); - }); - - /* - * @tc.number: context_getFilesDir_test_0100 - * @tc.name: getFilesDir : Obtains the files directory on internal storage. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it("context_getFilesDir_test_0100", 0, async function (done) { - console.log("------------------start context_getFilesDir_test_0100-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getFilesDir().then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getFilesDir_test_0100', timeOldStamp, timeNewStamp) - console.log("context_getFilesDir_test_0100:FilesDir is " + data); - }) - } catch (error) { - console.log("logMessage context_getFilesDir_test_0100: error = " + error); - expect(error).assertEqual("/data/storage/el2/base/haps/entry/files"); - } - var data1 = await context.getFilesDir(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("/data/storage/el2/base/haps/entry/files"); - done(); - console.log("------------------end context_getFilesDir_test_0100-------------------"); - }); - - /* - * @tc.number: context_getFilesDir_test_0200 - * @tc.name: getFilesDir : Obtains the files directory on internal storage. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it("context_getFilesDir_test_0200", 0, async function (done) { - console.log("------------------start context_getFilesDir_test_0200-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getFilesDir((err, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getFilesDir_test_0200', timeOldStamp, timeNewStamp) - console.log("context_getFilesDir_test_0200: getFilesDir successful, result = " + data); - }); - } catch (error) { - console.log("logMessage context_getFilesDir_test_0200: error = " + error); - expect(error).assertEqual("/data/storage/el2/base/haps/entry/files"); - } - var data1 = await context.getFilesDir(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("/data/storage/el2/base/haps/entry/files"); - done(); - console.log("------------------end context_getFilesDir_test_0200-------------------"); - }); - - - /* - * @tc.number: context_getOrCreateDistributedDir_test_0100 - * @tc.name: getOrCreateDistributedDir : Obtains the directory of Distributed files. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it("context_getOrCreateDistributedDir_0100", 0, async function (done) { - console.log("------------------start context_getOrCreateDistributedDir_0100-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getOrCreateDistributedDir().then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getOrCreateDistributedDir_0100', timeOldStamp, timeNewStamp); - console.log("context_getOrCreateDistributedDir_0100: DistributedDir is " + data); - }) - } catch (error) { - console.log("logMessage context_getOrCreateDistributedDir_0100: error = " + error); - expect(error).assertEqual("/data/storage/el2/distributedfiles/entry"); - } - var data1 = await context.getOrCreateDistributedDir(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("/data/storage/el2/distributedfiles"); - done(); - console.log("------------------end context_getOrCreateDistributedDir_0100-------------------"); - }); - - /* - * @tc.number: context_getOrCreateDistributedDir_0200 - * @tc.name: getOrCreateDistributedDir : Obtains the directory of Distributed files. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it("context_getOrCreateDistributedDir_0200", 0, async function (done) { - console.log("------------------start context_getOrCreateDistributedDir_0200-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getOrCreateDistributedDir((err, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getOrCreateDistributedDir_0200', timeOldStamp, timeNewStamp); - console.log("context_getOrCreateDistributedDir_0200: getOrCreateDistributedDir successful, result = " + data); - }); - } catch (error) { - console.log("logMessage context_getOrCreateDistributedDir_0200: error = " + error); - expect(error).assertEqual("/data/storage/el2/distributedfiles/entry"); - } - var data1 = await context.getOrCreateDistributedDir(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("/data/storage/el2/distributedfiles"); - done(); - console.log("------------------end context_getOrCreateDistributedDir_0200-------------------"); - }); - - /* - * @tc.number: context_getAppType_0100 - * @tc.name: getAppType : Obtains the type of current application. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it("context_getAppType_0100", 0, async function (done) { - console.log("------------------start context_getAppType_0100-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getAppType().then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAppType_0100_0100', timeOldStamp, timeNewStamp); - console.log("context_getAppType_0100: AppType is " + data); - }) - } catch (error) { - console.log("logMessage context_getAppType_0100: error = " + error); - expect(error).assertEqual("system"); - } - var data1 = await context.getAppType(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("system"); - done(); - console.log("------------------end context_getAppType_0100-------------------"); - }); - - /* - * @tc.number: context_getAppType_0200 - * @tc.name: getAppType : Obtains the type of current application. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it("context_getAppType_0200", 0, async function (done) { - console.log("------------------start context_getAppType_0200-------------------"); - try { - var timeOldStamp = await Utils.getNowTime(); - var context = await featureAbility.getContext(); - context.getAppType((err, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAppType_0200_0100', timeOldStamp, timeNewStamp); - console.log("context_getAppType_0200: getAppType successful, result = " + data); - }); - } catch (error) { - console.log("logMessage context_getAppType_0200: error = " + error); - expect(error).assertEqual("system"); - } - var data1 = await context.getAppType(); - expect(typeof (data1)).assertEqual("string"); - expect(data1).assertEqual("system"); - done(); - console.log("------------------end context_getAppType_0200-------------------"); - }); - }) -} diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index fea9b55619a3c88c223e58ba0c03d203ad1be8ca..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,30 +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 addContextAndAbilityJsunit from './addContextAndAbilityJsunit.test.ets'; -import getHapModuleInfoJsunit from './getHapModuleInfoJsunit.test.ets'; -import getAbilityInfoJsunit from './getAbilityInfoJsunit.test.ets'; -import getApplicationContext from './getApplicationContextJsunit.test.ets'; -import getAppVersionInfoJsunit from './getAppVersionInfoJsunit.test.ets'; -import ContextJsunit from './ContextJsunit.test.ets'; - -export default function testsuite() { - ContextJsunit(); - addContextAndAbilityJsunit(); - getHapModuleInfoJsunit(); - getAbilityInfoJsunit(); - getApplicationContext(); - getAppVersionInfoJsunit(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/Utils.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/Utils.ets deleted file mode 100644 index d347b04062965c665153e7ac358028d6ae274d53..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/Utils.ets +++ /dev/null @@ -1,47 +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. - */ - -export default class Utils { - static sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(reject) - }, time) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - static getNowTime() { - return new Date().getTime(); - } - - /** - * 接口调用时间 - * @param startTime 接口调用开始时间 - * @param endTime 接口调用结束时间 - */ - static getDurationTime(msg, startTime, endTime) { - console.info(msg + 'Get Interface startTime: ' + startTime); - console.info(msg + 'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg + 'Get Interface Duration: ' + duration); - return duration; - } -} - - - - diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets deleted file mode 100644 index 15644bc9e87d7e145387a823c114538db125390c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets +++ /dev/null @@ -1,301 +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 {describe, it, expect} from 'hypium/index'; -import Utils from './Utils'; -import ability_featureAbility from '@ohos.ability.featureAbility'; -import ability_particleAbility from '@ohos.ability.particleAbility'; -import abilityManager from "@ohos.application.appManager" - -const TAG_TEST_0100 = ' context_isUpdatingConfigurations_test_0100 '; -const TAG_TEST_0200 = ' context_isUpdatingConfigurations_test_0200 '; -const TAG_TEST_0300 = ' context_printDrawnCompleted_test_0100 '; -const TAG_TEST_0400 = ' context_printDrawnCompleted_test_0200 '; -const TAG_TEST_0500 = ' context_getAppMemorySize_test_0100 '; -const TAG_TEST_0600 = ' context_getAppMemorySize_test_0200 '; -const TAG_TEST_0700 = ' context_isRamConstrainedDevice_test_0100 '; -const TAG_TEST_0800 = ' context_isRamConstrainedDevice_test_0200 '; -const TAG_TEST_0900 = ' context_featureAbility_test_0100 '; -const TAG_TEST_0010 = ' context_featureAbility_test_0200 '; -const TAG_TEST_0011 = ' context_featureAbility_test_0300 '; -const TAG_TEST_0012 = ' context_featureAbility_test_0400 '; - -export default function addContextAndAbilityJsunit() { - describe('appInfoTest', function () { - /* - * @tc.number: context_isUpdatingConfigurations_test_0100 - * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0100, 0, async function (done) { - console.info(TAG_TEST_0100 + 'promise START'); - let detailed; - var startTime = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - await context.isUpdatingConfigurations().then((data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0100, startTime, endTime) - console.info(TAG_TEST_0100 + ' promise data is:' + JSON.stringify(data)); - detailed = data; - }).catch((error) => { - console.error(TAG_TEST_0100 + 'promise errors is: ' + JSON.stringify(error)); - }) - expect(typeof (detailed)).assertEqual("boolean"); - expect(detailed).assertEqual(false); - done(); - console.log('------------------ ' + TAG_TEST_0100 + ' end -------------------'); - }); - - /* - * @tc.number: context_isUpdatingConfigurations_test_0200 - * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it(TAG_TEST_0200, 0, async function (done) { - let detailed; - console.info(TAG_TEST_0200 + 'callBack START'); - try { - var startTime = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.isUpdatingConfigurations((error, data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0200, startTime, endTime) - detailed = data; - console.info(TAG_TEST_0200 + ' callBack succeeded. data is:' + JSON.stringify(data)); - }); - } catch (error) { - console.error(TAG_TEST_0200 + 'Operation failed. Cause: ' + JSON.stringify(error)); - } - await Utils.sleep(2000) - expect(typeof (detailed)).assertEqual("boolean"); - expect(detailed).assertEqual(false); - done(); - console.log('------------------ ' + TAG_TEST_0200 + ' end -------------------'); - }); - - /* - * @tc.number: context_printDrawnCompleted_test_0100 - * @tc.name: printDrawnCompleted : Inform the system of the time required to complete the drawing of the page - capability. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0300, 0, async function (done) { - let detailed; - console.info(TAG_TEST_0300 + 'callBack START'); - var startTime = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - await context.printDrawnCompleted().then((data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0300, startTime, endTime) - console.info(TAG_TEST_0300 + ' promise data is:' + JSON.stringify(data)); - detailed = data; - }).catch((error) => { - console.error(TAG_TEST_0300 + 'promise error is: ' + JSON.stringify(error)); - }); - await Utils.sleep(2000) - expect(detailed).assertEqual(null); - done(); - console.log('------------------ ' + TAG_TEST_0300 + ' end -------------------'); - }) - - - /* - * @tc.number: context_printDrawnCompleted_test_0200 - * @tc.name: printDrawnCompleted : Inform the system of the time required to complete the drawing of the page - capability. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it(TAG_TEST_0400, 0, async function (done) { - let detailed; - console.info(TAG_TEST_0400 + 'callBack START'); - try { - var startTime = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.printDrawnCompleted((error, data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0300, startTime, endTime) - detailed = data; - console.info(TAG_TEST_0400 + ' callBack succeeded. data is:' + JSON.stringify(data)); - }); - } catch (error) { - console.error(TAG_TEST_0400 + 'Operation failed. Cause: ' + JSON.stringify(error)); - } - await Utils.sleep(2000) - expect(detailed).assertEqual(null); - done(); - console.log('------------------ ' + TAG_TEST_0400 + ' end -------------------'); - }) - - - /* - * @tc.number: context_getAppMemorySize_test_0100 - * @tc.name: getAppMemorySize : Obtains the memory size of the application. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0500, 0, async function (done) { - console.info(TAG_TEST_0500 + 'promise START'); - let detailed; - var startTime = await Utils.getNowTime(); - await abilityManager.getAppMemorySize() - .then((data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) - console.info(TAG_TEST_0500 + ' promise data is:' + JSON.stringify(data)); - detailed = data; - }).catch((error) => { - console.error(TAG_TEST_0500 + 'promise errors is: ' + JSON.stringify(error)); - }) - await Utils.sleep(2000) - expect(typeof (detailed)).assertEqual("number"); - expect(detailed).assertEqual(512); - done(); - console.log('------------------ ' + TAG_TEST_0500 + ' end -------------------'); - }); - - /* - * @tc.number: context_getAppMemorySize_test_0200 - * @tc.name: getAppMemorySize : Obtains the memory size of the application. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it(TAG_TEST_0600, 0, async function (done) { - console.info(TAG_TEST_0600 + 'callBack START'); - var startTime = await Utils.getNowTime(); - abilityManager.getAppMemorySize((error, data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) - console.info(TAG_TEST_0600 + ' callBack error is: ' + JSON.stringify(error)); - console.info(TAG_TEST_0600 + ' callBack data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("number"); - expect(data).assertEqual(512); - console.log('------------------ ' + TAG_TEST_0600 + ' end -------------------'); - done(); - }) - }); - - /* - * @tc.number: context_isRamConstrainedDevice_test_0100 - * @tc.name: isRamConstrainedDevice : Obtains whether the current device has low ram. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0700, 0, async function (done) { - let detailed; - console.info(TAG_TEST_0700 + 'promise START'); - var startTime = await Utils.getNowTime(); - await abilityManager.isRamConstrainedDevice().then((data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) - console.info(TAG_TEST_0700 + ' promise data is:' + JSON.stringify(data)); - detailed = data; - }).catch((error) => { - console.error(TAG_TEST_0700 + 'promise errors is: ' + JSON.stringify(error)); - }) - await Utils.sleep(1000) - expect(typeof (detailed)).assertEqual("boolean"); - expect(detailed).assertEqual(false) - done(); - console.log('------------------ ' + TAG_TEST_0700 + ' end -------------------'); - }); - - /* - * @tc.number: context_isRamConstrainedDevice_test_0200 - * @tc.name: isRamConstrainedDevice : Obtains whether the current device has low ram. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it(TAG_TEST_0800, 0, async function (done) { - console.info(TAG_TEST_0800 + 'callBack START'); - var startTime = await Utils.getNowTime(); - abilityManager.isRamConstrainedDevice((error, data) => { - var endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) - console.info(TAG_TEST_0800 + ' callBack error is:' + error); - console.info(TAG_TEST_0800 + ' callBack data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("boolean"); - expect(data).assertEqual(false); - done(); - }) - console.log('------------------ ' + TAG_TEST_0800 + ' end -------------------'); - }); - /* - * @tc.number: context_featureAbility_test_0100 - * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode - * @tc.desc: Check the featureAbility.ErrorCode.NO_ERROR - * @tc.level 0 - */ - it(TAG_TEST_0900, 0, async function (done) { - console.info(TAG_TEST_0900 + ' NO_ERROR START'); - var no_error = ability_featureAbility.ErrorCode.NO_ERROR - console.info(TAG_TEST_0900 + ' featureAbility no_error is: ' + no_error); - expect(typeof (no_error)).assertEqual("number"); - expect(no_error).assertEqual(0); - done(); - console.log('------------------ ' + TAG_TEST_0900 + ' end -------------------'); - }); - - /* - * @tc.number: context_featureAbility_test_0200 - * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode - * @tc.desc: Check the featureAbility.ErrorCode.INVALID_PARAMETER - * @tc.level 0 - */ - it(TAG_TEST_0010, 0, async function (done) { - console.info(TAG_TEST_0010 + ' INVALID_PARAMETER START'); - var invalid_parameter = ability_featureAbility.ErrorCode.INVALID_PARAMETER - console.info(TAG_TEST_0010 + ' featureAbility invalid_parameter is: ' + invalid_parameter); - expect(typeof (invalid_parameter)).assertEqual("number"); - expect(invalid_parameter).assertEqual(-1); - done(); - console.log('------------------ ' + TAG_TEST_0010 + ' end -------------------'); - }); - - /* - * @tc.number: context_featureAbility_test_0300 - * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode - * @tc.desc: Check the featureAbility.ErrorCode.ABILITY_NOT_FOUND - * @tc.level 0 - */ - it(TAG_TEST_0011, 0, async function (done) { - console.info(TAG_TEST_0011 + ' ABILITY_NOT_FOUND START'); - var ability_not_found = ability_featureAbility.ErrorCode.ABILITY_NOT_FOUND - console.info(TAG_TEST_0011 + ' featureAbility ability_not_found is: ' + ability_not_found); - expect(typeof (ability_not_found)).assertEqual("number"); - expect(ability_not_found).assertEqual(-2); - done(); - console.log('------------------ ' + TAG_TEST_0011 + ' end -------------------'); - }); - - /* - * @tc.number: context_featureAbility_test_0400 - * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode - * @tc.desc: Check the featureAbility.ErrorCode.PERMISSION_DENY - * @tc.level 0 - */ - it(TAG_TEST_0012, 0, async function (done) { - console.info(TAG_TEST_0012 + ' PERMISSION_DENY START'); - var permission_deny = ability_featureAbility.ErrorCode.PERMISSION_DENY - console.info(TAG_TEST_0012 + ' featureAbility permission_deny is: ' + permission_deny); - expect(typeof (permission_deny)).assertEqual("number"); - expect(permission_deny).assertEqual(-3); - done(); - console.log('------------------ ' + TAG_TEST_0012 + ' end -------------------'); - }); - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets deleted file mode 100644 index 93c8b130ea2fb2fda1d162b0ceb7a981f9366d7b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets +++ /dev/null @@ -1,333 +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 {describe, it, expect} from 'hypium/index'; -import Utils from './Utils'; -import ability_featureAbility from '@ohos.ability.featureAbility'; - -export default function getHapModuleInfoJsunit() { - describe('appInfoTest', function () { - - /** - * @tc.number: context_getAbilityInfo_test_0100 - * @tc.name: getAbilityInfo:Query the current attributionability details. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it('context_getAbilityInfo_test_0100', 0, async function (done) { - console.info('[context_getAbilityInfo_test_0100] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - await context.getAbilityInfo() - .then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAbilityInfo_test_0100', timeOldStamp, timeNewStamp); - console.info('[context_getAbilityInfo_test_0100] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }).catch((error) => { - console.error('[context_getAbilityInfo_test_0100] failed:' + JSON.stringify(error)); - }) - var promise = await context.getAbilityInfo(); - console.info('--[context_getAbilityInfo_test_0100] check---'); - checkAbilityInfo('context_getAbilityInfo_test_0100', promise); - console.info('[context_getAbilityInfo_test_0100] FINISH'); - done(); - }); - - async function startAbility2() { - var str = { - "want": { - "bundleName": "com.ohos.acecollaboration", - "abilityName": "com.ohos.acecollaboration.MainAbility2", - }, - }; - ability_featureAbility.startAbility(str).then((data) => { - console.info('context_getAbilityInfo_test_0300 startMainAbility2 succeeded: ' + JSON.stringify(data)); - }).catch((error) => { - console.error('context_getAbilityInfo_test_0300 startMainAbility2 failed. Cause: ' + JSON.stringify(error)); - }); - } - - /** - * @tc.number: context_getAbilityInfo_test_0200 - * @tc.name: getAbilityInfo:Query the current attributionability details. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - * @tc.level 0 - */ - it('context_getAbilityInfo_test_0200', 0, async function (done) { - try { - console.info('[context_getAbilityInfo_test_0200] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.getAbilityInfo((error, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAbilityInfo_test_0200', timeOldStamp, timeNewStamp); - console.info('[context_getAbilityInfo_test_0200] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }); - } catch (error) { - console.error('[context_getAbilityInfo_test_0200] failed: ' + JSON.stringify(error)); - } - var callback = await context.getAbilityInfo(); - console.info('---[context_getAbilityInfo_test_0200] check---'); - checkAbilityInfo('context_getAbilityInfo_test_0200', callback); - console.info('[context_getAbilityInfo_test_0200] FINISH'); - done(); - }) - - - /** - * @tc.number: context_getAbilityInfo_test_0300_1 - * @tc.name: getAbilityInfo:Query the current attributionability details. - * @tc.desc: Check the return value of the interface - * @tc.level 0 - */ - it('context_getAbilityInfo_test_0300_1', 0, async function (done) { - console.info('[context_getAbilityInfo_test_0300] STARTability'); - startAbility2(); - done(); - }); - - /** - * @tc.number: context_getAbilityInfo_test_0400 - * @tc.name: getAbilityInfo:Query the current attributionability details. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it('context_getAbilityInfo_test_0400', 0, async function (done) { - console.info('[context_getAbilityInfo_test_0400] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - await context.getAbilityInfo() - .then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAbilityInfo_test_0400', timeOldStamp, timeNewStamp); - console.info('[context_getAbilityInfo_test_0400] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }).catch((error) => { - console.error('[context_getAbilityInfo_test_0400] failed:' + JSON.stringify(error)); - }) - var promise = await context.getAbilityInfo(); - console.info('--[context_getAbilityInfo_test_0400] check---'); - checkAbilityInfo('context_getAbilityInfo_test_0400', promise); - console.info('[context_getAbilityInfo_test_0400] FINISH'); - done(); - }); - - function checkAbilityInfo(msg, data) { - console.log(msg + "checkAbilityInfo start " + JSON.stringify(data)); - console.log(msg + "checkAbilityInfo bundleName : " + data.bundleName); - console.log(msg + "checkAbilityInfo name : " + data.name); - console.log(msg + "checkAbilityInfo label : " + data.label); - console.log(msg + "checkAbilityInfo description : " + data.description); - console.log(msg + "checkAbilityInfo icon : " + data.icon); - console.log(msg + "checkAbilityInfo descriptionId : " + data.descriptionId); - console.log(msg + "checkAbilityInfo iconId : " + data.iconId); - console.log(msg + "checkAbilityInfo moduleName : " + data.moduleName); - console.log(msg + "checkAbilityInfo process : " + data.process); - console.log(msg + "checkAbilityInfo targetAbility : " + data.targetAbility); - console.log(msg + "checkAbilityInfo backgroundModes : " + data.backgroundModes); - console.log(msg + "checkAbilityInfo isVisible : " + data.isVisible); - console.log(msg + "checkAbilityInfo formEnabled : " + data.formEnabled); - console.log(msg + "checkAbilityInfo type : " + data.type) - console.log(msg + "checkAbilityInfo orientation : " + data.orientation); - console.log(msg + "checkAbilityInfo launchMode : " + data.launchMode); - console.log(msg + "checkAbilityInfo permissions length : " + data.permissions.length); - for (var j = 0; j < data.permissions.length; j++) { - console.log(msg + "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); - } - console.log(msg + "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); - for (var k = 0; k < data.deviceTypes.length; k++) { - console.log(msg + "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); - } - console.log(msg + "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); - for (var i = 0; i < data.deviceCapabilities.length; i++) { - console.log(msg + "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]); - } - console.log(msg + "checkAbilityInfo readPermission : " + data.readPermission); - console.log(msg + "checkAbilityInfo writePermission : " + data.writePermission); - console.log(msg + "checkAbilityInfo formEntity : " + data.formEntity); - console.log(msg + "checkAbilityInfo minFormHeight : " + data.minFormHeight); - console.log(msg + "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); - console.log(msg + "checkAbilityInfo minFormWidth : " + data.minFormWidth); - console.log(msg + "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); - console.log(msg + "checkAbilityInfo uri : " + data.uri); - console.log(msg + "checkAbilityInfo customizeData : " + data.customizeData); - console.log(msg + "checkAbilityInfo labelId : " + data.labelId); - console.log(msg + "checkAbilityInfo subType : " + data.subType); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.bundleName)).assertEqual("string"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.process)).assertEqual("string"); - expect(typeof (data.targetAbility)).assertEqual("string"); - expect(typeof (data.backgroundModes)).assertEqual("number"); - expect(typeof (data.isVisible)).assertEqual("boolean"); - expect(typeof (data.formEnabled)).assertEqual("boolean"); - expect(typeof (data.type)).assertEqual("number"); - expect(typeof (data.subType)).assertEqual("number"); - expect(typeof (data.orientation)).assertEqual("number"); - expect(typeof (data.launchMode)).assertEqual("number"); - expect(Array.isArray(data.permissions)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); - expect(typeof (data.readPermission)).assertEqual("string"); - expect(typeof (data.writePermission)).assertEqual("string"); - expect(typeof (data.applicationInfo)).assertEqual("object"); - expect(typeof (data.formEntity)).assertEqual("number"); - expect(typeof (data.minFormHeight)).assertEqual("number"); - expect(typeof (data.defaultFormHeight)).assertEqual("number"); - expect(typeof (data.minFormWidth)).assertEqual("number"); - expect(typeof (data.defaultFormWidth)).assertEqual("number"); - expect(typeof (data.uri)).assertEqual("string"); - - expect(data.bundleName).assertEqual("com.ohos.acecollaboration"); - expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility"); - expect(data.label).assertEqual("$string:entry_MainAbility"); - expect(data.description).assertEqual("$string:mainability_description"); - expect(data.icon).assertEqual("$media:icon"); - expect(data.descriptionId > 0).assertTrue(); - expect(data.iconId > 0).assertTrue(); - expect(data.moduleName).assertEqual("entry"); - expect(data.process).assertEqual(""); - expect(data.targetAbility).assertEqual(""); - expect(data.backgroundModes).assertEqual(0); - expect(data.isVisible).assertEqual(true); - expect(data.formEnabled).assertEqual(false); - expect(data.type).assertEqual(1); - expect(data.orientation).assertEqual(0); - expect(data.launchMode).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.readPermission).assertEqual(""); - expect(data.writePermission).assertEqual(""); - checkApplicationInfo(msg, data.applicationInfo); - expect(data.formEntity).assertEqual(0); - expect(data.minFormHeight).assertEqual(0); - expect(data.defaultFormHeight).assertEqual(0); - expect(data.minFormWidth).assertEqual(0); - expect(data.defaultFormWidth).assertEqual(0); - expect(data.uri).assertEqual(""); - expect(data.labelId > 0).assertTrue(); - expect(data.subType).assertEqual(0); - - console.log(msg + "---checkAbilityInfo End--- "); - } - - function checkApplicationInfo(msg, info) { - console.log(msg + "checkApplicationInfo start : " + JSON.stringify(info)); - console.log(msg + "checkApplicationInfo name : " + info.name); - console.log(msg + "checkApplicationInfo description : " + info.description); - console.log(msg + "checkApplicationInfo descriptionId : " + info.descriptionId); - console.log(msg + "checkApplicationInfo systemApp : " + info.systemApp); - console.log(msg + "checkApplicationInfo enabled : " + info.enabled); - console.log(msg + "checkApplicationInfo label : " + info.label); - console.log(msg + "checkApplicationInfo labelId : " + info.labelId); - console.log(msg + "checkApplicationInfo icon : " + info.icon); - console.log(msg + "checkApplicationInfo iconId : " + info.iconId); - console.log(msg + "checkApplicationInfo process : " + info.process); - console.log(msg + "checkApplicationInfo supportedModes : " + info.supportedModes); - - console.log(msg + "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length); - for (var j = 0; j < info.moduleSourceDirs.length; j++) { - console.log(msg + "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]); - } - console.log(msg + "checkApplicationInfo permissions length : " + info.permissions.length); - for (var k = 0; k < info.permissions.length; k++) { - console.log(msg + "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]); - } - console.log(msg + "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length); - for (var i = 0; i < info.moduleInfos.length; i++) { - console.log(msg + "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " - + info.moduleInfos[i].moduleName); - console.log(msg + "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " - + info.moduleInfos[i].moduleSourceDir); - } - console.log(msg + "checkApplicationInfo entryDir : " + info.entryDir); - - expect(typeof (info)).assertEqual("object"); - expect(typeof (info.name)).assertEqual("string"); - expect(typeof (info.description)).assertEqual("string"); - expect(typeof (info.descriptionId)).assertEqual("number"); - expect(typeof (info.systemApp)).assertEqual("boolean"); - expect(typeof (info.enabled)).assertEqual("boolean"); - expect(typeof (info.label)).assertEqual("string"); - expect(typeof (info.labelId)).assertEqual("string"); - expect(typeof (info.icon)).assertEqual("string"); - expect(typeof (info.iconId)).assertEqual("string"); - expect(typeof (info.process)).assertEqual("string"); - expect(typeof (info.supportedModes)).assertEqual("number"); - expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); - expect(Array.isArray(info.permissions)).assertEqual(true); - expect(Array.isArray(info.moduleInfos)).assertEqual(true); - expect(typeof (info.entryDir)).assertEqual("string"); - - expect(info.name).assertEqual("com.ohos.acecollaboration"); - expect(info.description).assertEqual("$string:mainability_description"); - expect(info.descriptionId > 0).assertTrue(); - expect(info.systemApp).assertEqual(true); - expect(info.enabled).assertEqual(true); - expect(info.label).assertEqual("$string:entry_MainAbility"); - expect(info.icon).assertEqual("$media:icon"); - expect(info.process).assertEqual(""); - expect(info.supportedModes).assertEqual(0); - expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - if (info.moduleSourceDirs.length == 1){ - expect(info.moduleInfos[0].moduleName).assertEqual("entry"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - }else if(info.moduleSourceDirs.length == 2) { - if (info.moduleInfos[0].moduleName == "myapplication1") { - expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication1"); - expect(info.moduleInfos[1].moduleName).assertEqual("entry"); - expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - }else{ - expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication2"); - expect(info.moduleInfos[1].moduleName).assertEqual("entry"); - expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - } - }else { - expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication1"); - expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2"); - expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication2"); - expect(info.moduleInfos[2].moduleName).assertEqual("entry"); - expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - } - - console.log(msg + "---checkApplicationInfo End--- "); - - } - - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets deleted file mode 100644 index bcc246bc465015fde802853923899e4a5475b6a1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets +++ /dev/null @@ -1,92 +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 {describe, it, expect} from 'hypium/index'; -import Utils from './Utils'; -import ability_featureAbility from '@ohos.ability.featureAbility'; - -export default function getHapModuleInfoJsunit() { - describe('appInfoTest', function () { - /** - * @tc.number: context_getAppVersionInfo_test_0100 - * @tc.name: getAppVersionInfo:Gets the version information for the application. - * @tc.desc: Check the return type of the interface (by Promise) - * @tc.level 0 - */ - it('context_getAppVersionInfo_test_0100', 0, async function (done) { - console.info('[context_getAppVersionInfo_test_0100] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.getAppVersionInfo() - .then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAppVersionInfo_test_0100', timeOldStamp, timeNewStamp); - console.info('[context_getAppVersionInfo_test_0100] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }).catch((error) => { - console.error('[context_getAppVersionInfo_test_0100] failed:' + JSON.stringify(error)); - }) - var promise = await context.getAppVersionInfo(); - console.info('---[context_getAppVersionInfo_test_0100] check---'); - checkAppVersionInfo('context_getAppVersionInfo_test_0100', promise); - console.info('[context_getAppVersionInfo_test_0100] FINISH'); - done(); - }); - - /** - * @tc.number: context_getAppVersionInfo_test_0200 - * @tc.name: getAppVersionInfo:Gets the version information for the application. - * @tc.desc: Check the return type of the interface (by Callback) - * @tc.level 0 - */ - it('context_getAppVersionInfo_test_0200', 0, async function (done) { - try { - console.info('[context_getAppVersionInfo_test_0200] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.getAppVersionInfo((error, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getAppVersionInfo_test_0200', timeOldStamp, timeNewStamp); - console.info('[context_getAppVersionInfo_test_0200] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }); - } - catch (error) { - console.error('[context_getAppVersionInfo_test_0200] failed: ' + JSON.stringify(error)); - } - var callback = await context.getAppVersionInfo(); - console.info('---[context_getAppVersionInfo_test_0200] check---'); - checkAppVersionInfo('context_getAppVersionInfo_test_0200', callback); - console.info('[context_getAppVersionInfo_test_0200] FINISH'); - done(); - }); - - function checkAppVersionInfo(msg, data) { - console.log(msg + "checkAppVersionInfo start : " + JSON.stringify(data)); - console.log(msg + "checkAppVersionInfo appName : " + data.appName); - console.log(msg + "checkAppVersionInfo versionCode : " + data.versionCode); - console.log(msg + "checkAppVersionInfo versionName : " + data.versionName); - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.appName)).assertEqual("string"); - expect(typeof (data.versionCode)).assertEqual("number"); - expect(typeof (data.versionName)).assertEqual("string"); - expect(data.appName).assertEqual(""); - expect(data.versionCode).assertEqual(1000000); - expect(data.versionName).assertEqual("1.0.0"); - console.log(msg + "---checkAppVersionInfo End--- "); - } - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets deleted file mode 100644 index 25b351b61a82031d2d9ad400ed8be9ce9ab0e6ba..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets +++ /dev/null @@ -1,46 +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 {describe, it, expect} from 'hypium/index'; -import Utils from './Utils'; -import ability_featureAbility from '@ohos.ability.featureAbility'; - -export default function getHapModuleInfoJsunit() { - describe('appInfoTest', function () { - /** - * @tc.number: context_getApplicationContext_test_0100 - * @tc.name: getApplicationContext:Gets the application context information. - * @tc.desc: Check the return value of the interface - * @tc.level 0 - */ - it('context_getApplicationContext_test_0100', 0, async function (done) { - try { - console.info('[context_getApplicationContext_test_0100] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext().getApplicationContext(); - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getApplicationContext_test_0100', timeOldStamp, timeNewStamp); - console.info('[context_getApplicationContext_test_0100] data is:' + JSON.stringify(context)); - } - catch (error) { - console.error('[context_getApplicationContext_test_0100] failed:' + JSON.stringify(error)); - } - expect(typeof (context)).assertEqual("object"); - console.info('[context_getApplicationContext_test_0100] FINISH'); - done(); - }); - - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets deleted file mode 100644 index b012afe8b3ebf0abd0f039bdd4f9e747905987a6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets +++ /dev/null @@ -1,233 +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 {describe, it, expect} from 'hypium/index'; -import Utils from './Utils'; -import ability_featureAbility from '@ohos.ability.featureAbility'; - -export default function getHapModuleInfoJsunit() { - describe('appInfoTest', function () { - /** - * @tc.number: context_getHapModuleInfo_test_0100 - * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return type of the interface (by Promise) - * @tc.level 0 - */ - it('context_getHapModuleInfo_test_0100', 0, async function (done) { - console.info('[context_getHapModuleInfo_test_0100] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.getHapModuleInfo() - .then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getHapModuleInfo_test_0100', timeOldStamp, timeNewStamp); - console.info('[context_getHapModuleInfo_test_0100] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }) - .catch((error) => { - console.error('[context_getHapModuleInfo_test_0100] failed:' + JSON.stringify(error)); - }) - var promise = await context.getHapModuleInfo(); - console.info('---[context_getHapModuleInfo_test_0100] check---'); - checkHapModuleInfo('context_getHapModuleInfo_test_0100', promise); - console.info('[context_getHapModuleInfo_test_0100] FINISH'); - done(); - }); - - /** - * @tc.number: context_getHapModuleInfo_test_0200 - * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return type of the interface (by Callback) - * @tc.level 0 - */ - it('context_getHapModuleInfo_test_0200', 0, async function (done) { - let callback; - try { - console.info('[context_getHapModuleInfo_test_0200] START'); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.getHapModuleInfo((error, data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getHapModuleInfo_test_0200', timeOldStamp, timeNewStamp); - console.info('[context_getHapModuleInfo_test_0200] data is:' + JSON.stringify(data)); - callback = data; - expect(typeof (data)).assertEqual("object"); - }); - } catch (error) { - console.error('[context_getHapModuleInfo_test_0200] failed: ' + JSON.stringify(error)); - } - await Utils.sleep(1000); - console.info('---[context_getHapModuleInfo_test_0200] check---'); - checkHapModuleInfo('context_getHapModuleInfo_test_0200', callback); - console.info('[context_getHapModuleInfo_test_0200] FINISH'); - done(); - }); - - function checkHapModuleInfo(msg, data) { - console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data)); - console.log(msg + "checkHapModuleInfo name : " + data.name); - console.log(msg + "checkHapModuleInfo description : " + data.description); - console.log(msg + "checkHapModuleInfo descriptionId : " + data.descriptionId); - console.log(msg + "checkHapModuleInfo icon : " + data.icon); - console.log(msg + "checkHapModuleInfo label : " + data.label); - console.log(msg + "checkHapModuleInfo labelId : " + data.labelId); - console.log(msg + "checkHapModuleInfo iconId : " + data.iconId); - console.log(msg + "checkHapModuleInfo backgroundImg : " + data.backgroundImg); - console.log(msg + "checkHapModuleInfo supportedModes : " + data.supportedModes); - console.log(msg + "checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); - for (var j = 0; j < data.reqCapabilities.length; j++) { - console.log(msg + "getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); - } - console.log(msg + "checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); - for (var k = 0; k < data.deviceTypes.length; k++) { - console.log(msg + "getHapModuleInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); - } - console.log(msg + "checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length); - console.log(msg + "checkHapModuleInfo moduleName : " + data.moduleName); - console.log(msg + "checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); - console.log(msg + "checkHapModuleInfo installationFree : " + data.installationFree); - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.backgroundImg)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.reqCapabilities)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.abilityInfos)).assertEqual(true); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.mainAbilityName)).assertEqual("string"); - expect(typeof (data.installationFree)).assertEqual("boolean"); - expect(data.name).assertEqual("com.ohos.acecollaboration"); - expect(data.description).assertEqual(""); - expect(data.descriptionId).assertEqual(0); - expect(data.icon).assertEqual("$media:icon"); - expect(data.label).assertEqual("$string:entry_MainAbility"); - expect(data.labelId).assertEqual(0); - expect(data.iconId).assertEqual(0); - expect(data.backgroundImg).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - expect(data.deviceTypes[0]).assertEqual("phone"); - checkAbilityInfo(msg,data.abilityInfos[0]); - expect(data.moduleName).assertEqual("entry") - expect(data.mainAbilityName).assertEqual(""); - expect(data.installationFree).assertEqual(false); - console.log(msg + "---checkHapModuleInfo End---"); - } - - function checkAbilityInfo(msg,data) { - console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data)); - console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName); - console.log(msg+ "checkAbilityInfo name : " + data.name); - console.log(msg+ "checkAbilityInfo label : " + data.label); - console.log(msg+ "checkAbilityInfo description : " + data.description); - console.log(msg+ "checkAbilityInfo icon : " + data.icon); - console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId); - console.log(msg+ "checkAbilityInfo iconId : " + data.iconId); - console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName); - console.log(msg+ "checkAbilityInfo process : " + data.process); - console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility); - console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes); - console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible); - console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled); - console.log(msg+ "checkAbilityInfo type : " + data.type) - console.log(msg+ "checkAbilityInfo orientation : " + data.orientation); - console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode); - console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length); - for (var j = 0; j < data.permissions.length; j++) { - console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); - } - console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); - for (var k = 0; k < data.deviceTypes.length; k++) { - console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); - } - console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); - for (var i = 0; i < data.deviceCapabilities.length; i++) { - console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]); - } - console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission); - console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission); - console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity); - console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight); - console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); - console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth); - console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); - console.log(msg+ "checkAbilityInfo uri : " + data.uri); - console.log(msg+ "checkAbilityInfo labelId : " + data.labelId); - console.log(msg+ "checkAbilityInfo subType : " + data.subType); - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.bundleName)).assertEqual("string"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.process)).assertEqual("string"); - expect(typeof (data.targetAbility)).assertEqual("string"); - expect(typeof (data.backgroundModes)).assertEqual("number"); - expect(typeof (data.isVisible)).assertEqual("boolean"); - expect(typeof (data.formEnabled)).assertEqual("boolean"); - expect(typeof (data.type)).assertEqual("number"); - expect(typeof (data.subType)).assertEqual("number"); - expect(typeof (data.orientation)).assertEqual("number"); - expect(typeof (data.launchMode)).assertEqual("number"); - expect(Array.isArray(data.permissions)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); - expect(typeof (data.readPermission)).assertEqual("string"); - expect(typeof (data.writePermission)).assertEqual("string"); - expect(typeof (data.applicationInfo)).assertEqual("object"); - expect(typeof (data.formEntity)).assertEqual("number"); - expect(typeof (data.minFormHeight)).assertEqual("number"); - expect(typeof (data.defaultFormHeight)).assertEqual("number"); - expect(typeof (data.minFormWidth)).assertEqual("number"); - expect(typeof (data.defaultFormWidth)).assertEqual("number"); - expect(typeof (data.uri)).assertEqual("string"); - expect(data.bundleName).assertEqual("com.ohos.acecollaboration"); - expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility"); - expect(data.label).assertEqual("$string:entry_MainAbility"); - expect(data.description).assertEqual("$string:mainability_description"); - expect(data.icon).assertEqual("$media:icon"); - expect(data.moduleName).assertEqual("entry"); - expect(data.process).assertEqual(""); - expect(data.targetAbility).assertEqual(""); - expect(data.backgroundModes).assertEqual(0); - expect(data.isVisible).assertEqual(true); - expect(data.formEnabled).assertEqual(false); - expect(data.type).assertEqual(1); - expect(data.orientation).assertEqual(0); - expect(data.launchMode).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.readPermission).assertEqual(""); - expect(data.writePermission).assertEqual(""); - expect(data.formEntity).assertEqual(0); - expect(data.minFormHeight).assertEqual(0); - expect(data.defaultFormHeight).assertEqual(0); - expect(data.minFormWidth).assertEqual(0); - expect(data.defaultFormWidth).assertEqual(0); - expect(data.uri).assertEqual(""); - expect(data.subType).assertEqual(0); - console.log(msg+ "---checkAbilityInfo End--- "); - } - - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index febe5eef2727a008fe870ae874cc219ef5653f20..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - }, - { - "name": "description_serviceability2", - "value": "hap sample empty service" - }, - { - "name": "description_serviceability3", - "value": "hap sample empty service" - }, - { - "name": "description_serviceability4", - "value": "hap sample empty service" - }, - { - "name": "description_serviceability5", - "value": "hap sample empty service" - }, - { - "name": "description_mainability2", - "value": "eTS_Empty Ability2" - }, - { - "name": "entry_MainAbility2", - "value": "MainAbility2" - }, - { - "name": "description_serviceability6", - "value": "hap sample empty service" - }, - { - "name": "description_serviceability7", - "value": "hap sample empty service" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json deleted file mode 100644 index c7a8264f21f89dbeada57ecb990c257dbb0d7bf2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.acecollaboration", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.myapplication1", - "name": ".MyApplication", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "myapplication1", - "moduleType": "feature", - "installationFree": false - }, - "abilities": [ - { - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:myapplication1_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 6a47e22427b28a7af740c97ab4467f0872c41496..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index f624baca1eef7433bd450a120f3b0dbb29053a76..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,49 +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 file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; -import testsuite_app1 from "../test/List.test.ets"; -import featureAbility from "@ohos.ability.featureAbility"; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(this) - testsuite_app1(); - core.execute(); - } - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('myapplication1 page') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index d154c999065b0b646e3913a1bd62d30fbf33e491..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/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 getHapModuleInfoJsunit_app1 from './getHapModuleInfoJsunit_app1.test.ets'; - -export default function testsuite_app1() { - getHapModuleInfoJsunit_app1(); - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 6ebf5db93fff3b99d15eb14c76e11d4f8f32c827..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,42 +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. - */ - -export default class Utils { - static sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(reject) - }, time) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - static getNowTime() { - return new Date().getTime(); - } - - static getDurationTime(msg,startTime, endTime) { - console.info(msg+'Get Interface startTime: ' + startTime); - console.info(msg+'Get Interface endTime: ' + endTime); - var duration = (endTime - startTime) - console.info(msg+'Get Interface Duration: ' + duration); - return duration; - } -} - - - - diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets deleted file mode 100644 index 741a34c2859e17a2f78c50d1725c6800942a6e5a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets +++ /dev/null @@ -1,301 +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 {describe, it, expect} from "deccjsunit/index.ets"; -import Utils from './Utils'; -import ability_featureAbility from '@ohos.ability.featureAbility'; - -export default function getHapModuleInfoJsunit() { - describe('appInfoTest', function () { - - /** - * @tc.number: context_getHapModuleInfo_test_0300 - * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return type of the interface (by Promise) - * @tc.level 0 - */ - it('context_getHapModuleInfo_test_0300', 0, async function (done) { - console.info('[context_getHapModuleInfo_test_0300] START'); - await Utils.sleep(1000); - var timeOldStamp = await Utils.getNowTime(); - var context = ability_featureAbility.getContext(); - context.getHapModuleInfo() - .then((data) => { - var timeNewStamp = Utils.getNowTime(); - Utils.getDurationTime('context_getHapModuleInfo_test_0300', timeOldStamp, timeNewStamp); - console.info('[context_getHapModuleInfo_test_0300] data is:' + JSON.stringify(data)); - expect(typeof (data)).assertEqual("object"); - }) - .catch((error) => { - console.error('[context_getHapModuleInfo_test_0300] failed:' + JSON.stringify(error)); - }) - var promise = await context.getHapModuleInfo(); - console.info('---[context_getHapModuleInfo_test_0300] check---'); - checkHapModuleInfo_app('context_getHapModuleInfo_test_0300', promise); - console.info('[context_getHapModuleInfo_test_0300] FINISH'); - done(); - }); - - function checkHapModuleInfo_app(msg, data) { - console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data)); - console.log(msg + "checkHapModuleInfo name : " + data.name); - console.log(msg + "checkHapModuleInfo description : " + data.description); - console.log(msg + "checkHapModuleInfo descriptionId : " + data.descriptionId); - console.log(msg + "checkHapModuleInfo icon : " + data.icon); - console.log(msg + "checkHapModuleInfo label : " + data.label); - console.log(msg + "checkHapModuleInfo labelId : " + data.labelId); - console.log(msg + "checkHapModuleInfo iconId : " + data.iconId); - console.log(msg + "checkHapModuleInfo backgroundImg : " + data.backgroundImg); - console.log(msg + "checkHapModuleInfo supportedModes : " + data.supportedModes); - console.log(msg + "checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); - for (var j = 0; j < data.reqCapabilities.length; j++) { - console.log(msg + "getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); - } - console.log(msg + "checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); - for (var k = 0; k < data.deviceTypes.length; k++) { - console.log(msg + "getHapModuleInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); - } - console.log(msg + "checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length); - console.log(msg + "checkHapModuleInfo moduleName : " + data.moduleName); - console.log(msg + "checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); - console.log(msg + "checkHapModuleInfo installationFree : " + data.installationFree); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.backgroundImg)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.reqCapabilities)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.abilityInfos)).assertEqual(true); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.mainAbilityName)).assertEqual("string"); - expect(typeof (data.installationFree)).assertEqual("boolean"); - expect(data.name).assertEqual("com.example.myapplication1"); - expect(data.description).assertEqual(""); - expect(data.descriptionId).assertEqual(0); - expect(data.icon).assertEqual("$media:icon"); - expect(data.label).assertEqual("$string:myapplication1_MainAbility"); - expect(data.labelId).assertEqual(0); - expect(data.iconId).assertEqual(0); - expect(data.backgroundImg).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - - expect(data.deviceTypes[0]).assertEqual("phone"); - checkAbilityInfo(msg,data.abilityInfos[0]); - - expect(data.moduleName).assertEqual("myapplication1") - expect(data.mainAbilityName).assertEqual(""); - expect(data.installationFree).assertEqual(false); - - console.log(msg + "---checkHapModuleInfo End---"); - } - - function checkAbilityInfo(msg,data) { - console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data)); - console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName); - console.log(msg+ "checkAbilityInfo name : " + data.name); - console.log(msg+ "checkAbilityInfo label : " + data.label); - console.log(msg+ "checkAbilityInfo description : " + data.description); - console.log(msg+ "checkAbilityInfo icon : " + data.icon); - console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId); - console.log(msg+ "checkAbilityInfo iconId : " + data.iconId); - console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName); - console.log(msg+ "checkAbilityInfo process : " + data.process); - console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility); - console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes); - console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible); - console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled); - console.log(msg+ "checkAbilityInfo type : " + data.type) - console.log(msg+ "checkAbilityInfo orientation : " + data.orientation); - console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode); - console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length); - for (var j = 0; j < data.permissions.length; j++) { - console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); - } - console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); - for (var k = 0; k < data.deviceTypes.length; k++) { - console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); - } - console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); - for (var i = 0; i < data.deviceCapabilities.length; i++) { - console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]); - } - console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission); - console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission); - console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity); - console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight); - console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); - console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth); - console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); - console.log(msg+ "checkAbilityInfo uri : " + data.uri); - console.log(msg+ "checkAbilityInfo labelId : " + data.labelId); - console.log(msg+ "checkAbilityInfo subType : " + data.subType); - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.bundleName)).assertEqual("string"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.process)).assertEqual("string"); - expect(typeof (data.targetAbility)).assertEqual("string"); - expect(typeof (data.backgroundModes)).assertEqual("number"); - expect(typeof (data.isVisible)).assertEqual("boolean"); - expect(typeof (data.formEnabled)).assertEqual("boolean"); - expect(typeof (data.type)).assertEqual("number"); - expect(typeof (data.subType)).assertEqual("number"); - expect(typeof (data.orientation)).assertEqual("number"); - expect(typeof (data.launchMode)).assertEqual("number"); - expect(Array.isArray(data.permissions)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); - expect(typeof (data.readPermission)).assertEqual("string"); - expect(typeof (data.writePermission)).assertEqual("string"); - expect(typeof (data.applicationInfo)).assertEqual("object"); - expect(typeof (data.formEntity)).assertEqual("number"); - expect(typeof (data.minFormHeight)).assertEqual("number"); - expect(typeof (data.defaultFormHeight)).assertEqual("number"); - expect(typeof (data.minFormWidth)).assertEqual("number"); - expect(typeof (data.defaultFormWidth)).assertEqual("number"); - expect(typeof (data.uri)).assertEqual("string"); - expect(data.bundleName).assertEqual("com.ohos.acecollaboration"); - expect(data.name).assertEqual("com.example.myapplication1.MainAbility"); - expect(data.label).assertEqual("$string:myapplication1_MainAbility"); - expect(data.description).assertEqual("$string:description_mainability"); - expect(data.icon).assertEqual("$media:icon"); - expect(data.descriptionId > 0).assertTrue(); - expect(data.iconId > 0).assertTrue(); - expect(data.moduleName).assertEqual("myapplication1"); - expect(data.process).assertEqual(""); - expect(data.targetAbility).assertEqual(""); - expect(data.backgroundModes).assertEqual(0); - expect(data.isVisible).assertEqual(true); - expect(data.formEnabled).assertEqual(false); - expect(data.type).assertEqual(1); - expect(data.orientation).assertEqual(0); - expect(data.launchMode).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.readPermission).assertEqual(""); - expect(data.writePermission).assertEqual(""); - checkApplicationInfo(msg,data.applicationInfo); - expect(data.formEntity).assertEqual(0); - expect(data.minFormHeight).assertEqual(0); - expect(data.defaultFormHeight).assertEqual(0); - expect(data.minFormWidth).assertEqual(0); - expect(data.defaultFormWidth).assertEqual(0); - expect(data.uri).assertEqual(""); - expect(data.labelId > 0).assertTrue(); - expect(data.subType).assertEqual(0); - console.log(msg+ "---checkAbilityInfo End--- "); - } - - function checkApplicationInfo(msg,info) { - console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info)); - console.log(msg+ "checkApplicationInfo name : " + info.name); - console.log(msg+ "checkApplicationInfo description : " + info.description); - console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId); - console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp); - console.log(msg+ "checkApplicationInfo enabled : " + info.enabled); - console.log(msg+ "checkApplicationInfo label : " + info.label); - console.log(msg+ "checkApplicationInfo labelId : " + info.labelId); - console.log(msg+ "checkApplicationInfo icon : " + info.icon); - console.log(msg+ "checkApplicationInfo iconId : " + info.iconId); - console.log(msg+ "checkApplicationInfo process : " + info.process); - console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes); - console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length); - for (var j = 0; j < info.moduleSourceDirs.length; j++) { - console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]); - } - console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length); - for (var k = 0; k < info.permissions.length; k++) { - console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]); - } - console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length); - for (var i = 0; i < info.moduleInfos.length; i++) { - console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " + info.moduleInfos[i].moduleName); - console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " + info.moduleInfos[i].moduleSourceDir); - } - console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir); - expect(typeof (info)).assertEqual("object"); - expect(typeof (info.name)).assertEqual("string"); - expect(typeof (info.description)).assertEqual("string"); - expect(typeof (info.descriptionId)).assertEqual("number"); - expect(typeof (info.systemApp)).assertEqual("boolean"); - expect(typeof (info.enabled)).assertEqual("boolean"); - expect(typeof (info.label)).assertEqual("string"); - expect(typeof (info.labelId)).assertEqual("string"); - expect(typeof (info.icon)).assertEqual("string"); - expect(typeof (info.iconId)).assertEqual("string"); - expect(typeof (info.process)).assertEqual("string"); - expect(typeof (info.supportedModes)).assertEqual("number"); - expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); - expect(Array.isArray(info.permissions)).assertEqual(true); - expect(Array.isArray(info.moduleInfos)).assertEqual(true); - expect(typeof (info.entryDir)).assertEqual("string"); - expect(info.name).assertEqual("com.ohos.acecollaboration"); - expect(info.description).assertEqual("$string:mainability_description"); - expect(info.descriptionId > 0).assertTrue(); - expect(info.systemApp).assertEqual(true); - expect(info.enabled).assertEqual(true); - expect(info.label).assertEqual("$string:entry_MainAbility"); - expect(info.icon).assertEqual("$media:icon"); - expect(info.process).assertEqual(""); - expect(info.supportedModes).assertEqual(0); - if (info.moduleSourceDirs.length == 1){ - expect(info.moduleInfos[0].moduleName).assertEqual("entry"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - }else if(info.moduleSourceDirs.length == 2) { - if (info.moduleInfos[0].moduleName == "myapplication1") { - expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication1"); - expect(info.moduleInfos[1].moduleName).assertEqual("entry"); - expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - }else{ - expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication2"); - expect(info.moduleInfos[1].moduleName).assertEqual("entry"); - expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - } - }else { - expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication1"); - expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2"); - expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.example.myapplication2"); - expect(info.moduleInfos[2].moduleName).assertEqual("entry"); - expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - } - expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - console.log(msg+ "---checkApplicationInfo End--- "); - } - - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json deleted file mode 100644 index 48c85e3618d9895d149e9f2a8674d03f02038d90..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "myapplication1_MainAbility", - "value": "myapplication1_MainAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/SecondAbility/SecondAbility.ts b/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/SecondAbility/SecondAbility.ts deleted file mode 100755 index d3d4c1daaee21209450190036ee55c176a68ee00..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ /dev/null @@ -1,125 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCalleeA MainAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA SecondAbility Call_Finish<======') - }) - - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCalleeA MainAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class SecondAbility extends Ability { - test2200(data) { - console.log("SystemAppCalleeA SecondAbility test2200"); - let recvData = new MySequenceable(0, '', ''); - data.readSequenceable(recvData); - let result = new MySequenceable(recvData.num + 1, recvData.str + "SystemAppCalleeA", ''); - return result; - } - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemAppCalleeA SecondAbility onCreate") - globalThis.abilityWant = want; - globalThis.abilityContext2 = this.context; - this.callee.on('test2200', this.test2200); - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemAppCalleeA SecondAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemAppCalleeA SecondAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemAppCalleeA SecondAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemAppCalleeA SecondAbility onForeground"); - } - - onBackground() { - // Ability has back to background - console.log("SystemAppCalleeA SecondAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/ThirdAbility/ThirdAbility.ts deleted file mode 100755 index 3352e2a3af8ce3d323225bbe2db4ec0e943eaa17..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/ThirdAbility/ThirdAbility.ts +++ /dev/null @@ -1,116 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCallerA MainAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA SecondAbility Call_Finish<======') - }) - - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCallerA MainAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class ThirdAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemAppCalleeA ThirdAbility onCreate") - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - globalThis.abilityWant = want; - globalThis.abilityContext3 = this.context; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemAppCalleeA ThirdAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemAppCalleeA ThirdAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemAppCalleeA ThirdAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemAppCalleeA ThirdAbility onForeground"); - } - - onBackground() { - // Ability has back to background - console.log("SystemAppCalleeA ThirdAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/SecondAbility/SecondAbility.ts b/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/SecondAbility/SecondAbility.ts deleted file mode 100755 index b01244eb104bb7cb91bfd56336fa0c39f0d1a986..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ /dev/null @@ -1,126 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCallerA SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA SecondAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCallerA SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class SecondAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemAppCallerA SecondAbility onCreate") - globalThis.abilityWant = want; - globalThis.abilityContext = this.context; - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemAppCallerA SecondAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemAppCallerA SecondAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemAppCallerA SecondAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemAppCallerA SecondAbility onForeground"); - if ((globalThis.abilityWant.parameters.case_num == "case0700") || - (globalThis.abilityWant.parameters.case_num == "case0800")) { - console.log("SystemAppCallerA SecondAbility special process in"); - var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; - var commonEventData = { - data: publishData, - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>SystemAppCallerA SecondAbility Call_Finish<======') - }) - } - } - - onBackground() { - // Ability has back to background - console.log("SystemAppCallerA SecondAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/ThirdAbility/ThirdAbility.ts deleted file mode 100755 index fcdb359fcf08694e32bcc3789fc252ad046e05ed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/ThirdAbility/ThirdAbility.ts +++ /dev/null @@ -1,125 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCallerA ThirdAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA ThirdAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemAppCallerA ThirdAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class ThirdAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemAppCallerA ThirdAbility onCreate") - globalThis.abilityWant = want; - globalThis.abilityContext = this.context; - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemAppCallerA ThirdAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemAppCallerA ThirdAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemAppCallerA ThirdAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemAppCallerA ThirdAbility onForeground"); - if ((globalThis.abilityWant.parameters.case_num == "case0700") || - (globalThis.abilityWant.parameters.case_num == "case0800")) { - var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; - var commonEventData = { - data: publishData, - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>SystemAppCallerA ThirdAbility Call_Finish<======') - }) - } - } - - onBackground() { - // Ability has back to background - console.log("SystemAppCallerA ThirdAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/Test.json b/aafwk/aafwk_standard/actscalltest/systemcallentrytest/Test.json deleted file mode 100755 index 9e244efab107c2acc4f7a1dd68f19e6a3ce92f3a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/Test.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.example.systemcalltest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsCallTestEntryTest.hap", - "ActsCallTestFeatureRelyHap.hap", - "ActsSystemAppCallerARelyHap.hap", - "ActsSystemAppCallerBRelyHap.hap", - "ActsSystemAppCallerCRelyHap.hap", - "ActsSystemAppCalleeARelyHap.hap", - "ActsThirdAppARelyHap.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/SecondAbility/SecondAbility.ts b/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/SecondAbility/SecondAbility.ts deleted file mode 100755 index cb568532dbb17c17aafa51c222f08b68dfb5c2a6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ /dev/null @@ -1,253 +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' -import commonEvent from '@ohos.commonEvent' - -var callerA = "SystemAppCallerA" -var callSeqA= new Array(); -var callerB = "SystemAppCallerB" -var callSeqB= new Array(); -var callerC = "SystemAppCallerC" -var callSeqC= new Array(); -var seq = 0; - -function isArrayEqual(a1, a2) { - return a1.length==a2.length && a1.every(function(value,index) { return value === a2[index]}); -} -function isArrayEqualWithoutOrder(a1, a2) { - if (a1.length != a2.length) { - return false; - } - for (let ind in a1) { - if (a2.indexOf(a1[ind]) == -1) { - return false; - }; - } - return true; -} -var expectStressResult=[0,1,2,3,4,5,6,7,8,9]; - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA SecondAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCall2(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed2'; - var commonEventData = { - code: 0, - data: 'calleeCheckCall2Param', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA SecondAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -function test2100ReleaseCallback(data) { - console.log('SystemCallTest SecondAbility test2100ReleaseCallback:' + data); - test2100ReleaseFlag = data.toString(); -} - -var test2100ReleaseFlag = ''; - -export default class SecondAbility extends Ability { - - test2100(data) { - let recvData = new MySequenceable(0, '', ''); - data.readSequenceable(recvData); - let want = { - bundleName: "com.example.systemcalltest", - abilityName: "com.example.systemcalltest.MainAbility", - }; - console.log("SystemCallTest SecondAbility test2100 before startAbilityByCall"); - let resultData = new MySequenceable(0, '', ''); - globalThis.abilityContext2.startAbilityByCall(want).then((caller) => { - let param = new MySequenceable(recvData.num + 1, recvData.str + "Second", recvData.result); - caller.onRelease(test2100ReleaseCallback); - for (let start=Date.now(); Date.now() - start <= 200;); - caller.callWithResult('test2100', param).then((data2) => { - data2.readSequenceable(resultData); - caller.release(); - for (let start=Date.now(); Date.now() - start <= 200;); - resultData.result = test2100ReleaseFlag; - let commonEventData = { - parameters: { - num: resultData.num, - str: resultData.str, - result: resultData.result, - } - }; - commonEvent.publish('call_case2100_test_result', commonEventData, (err) => { - console.log('SystemCallTest SecondAbility publish call_case2200_test_result event'); - }) - - }); - }); - return resultData; - } - - testOff(data) { - let recvSequence = new MySequenceable(0, '', ''); - data.readSequenceable(recvSequence); - return recvSequence; - } - - stressMethod(data) { - let recvData = new MySequenceable(0, '', ''); - data.readSequenceable(recvData); - console.log('SystemCallTest SecondAbility stressMethod caller ' + recvData.str); - if (recvData.str == callerA) { - callSeqA.push(recvData.num); - } else if (recvData.str == callerB) { - callSeqB.push(recvData.num); - } else if (recvData.str == callerC) { - callSeqC.push(recvData.num); - } - seq++; - if (seq >= 30) { - console.log('SystemCallTest SecondAbility stressMethod SystemAppCallerA ' + callSeqA); - console.log('SystemCallTest SecondAbility stressMethod SystemAppCallerB ' + callSeqB); - console.log('SystemCallTest SecondAbility stressMethod SystemAppCallerC ' + callSeqC); - let stressResult=isArrayEqualWithoutOrder(callSeqA, expectStressResult); - stressResult=stressResult&&isArrayEqualWithoutOrder(callSeqB, expectStressResult); - stressResult=stressResult&&isArrayEqualWithoutOrder(callSeqC, expectStressResult); - console.log('SystemCallTest SecondAbility stressMethod stressResult ' + stressResult); - let commonEventData = { - data: stressResult.toString(), - }; - commonEvent.publish('com.example.systemcalltest.Test5600', commonEventData, (err) => { - console.log('SystemCallTest SecondAbility stress test result event'); - }); - seq=0; - callSeqA = []; - callSeqB = []; - callSeqC = []; - } - return recvData; - } - - loopMethod(data) { - let recvData = new MySequenceable(0, '', ''); - data.readSequenceable(recvData); - return new MySequenceable(recvData.num + 1, recvData.str, ''); - } - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemCallTest SecondAbility onCreate") - globalThis.abilityWant = want; - globalThis.secondCallee = this.callee; - globalThis.abilityContext2 = this.context; - this.callee.on('test2100', this.test2100); - this.callee.on('testOff', this.testOff); - this.callee.on('stressMethod', this.stressMethod); - this.callee.on('loopMethod', this.loopMethod); - this.callee.on('testCall', testCall); - this.callee.on('testCall2', testCall2); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemCallTest SecondAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemCallTest SecondAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/second/second", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemCallTest SecondAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemCallTest SecondAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("SystemCallTest SecondAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 26746b5a84730dfe5b9220652170de21d515737f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 10000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100755 index 26c588b530c28551b7b22228b701df4314253670..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,1790 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -import missionManager from '@ohos.application.missionManager' -import appManager from '@ohos.application.appManager' - -const MAX_MISSION_NUM = 1024; -var sysABundleName = "com.example.systemcalltest"; -var sysAMainAbilityName = "com.example.systemcalltest.MainAbility"; -var sysASecondAbilityName = "com.example.systemcalltest.SecondAbility"; -var systemAppCallerABundleName = "com.example.systemappcallera"; -var systemAppCallerAMainAbilityName = "com.example.systemappcallera.MainAbility"; -var systemAppCallerASecondAbilityName = "com.example.systemappcallera.SecondAbility"; -var systemAppCallerAThirdAbilityName = "com.example.systemappcallera.ThirdAbility"; - -var systemAppCalleeABundleName = "com.example.systemappcalleea"; -var systemAppCalleeAMainAbilityName = "com.example.systemappcalleea.MainAbility"; -var systemAppCalleeASecondAbilityName = "com.example.systemappcalleea.SecondAbility"; -var systemAppCalleeAThirdAbilityName = "com.example.systemappcalleea.ThirdAbility"; - -var systemAppCalleeBBundleName = "com.example.systemappcalleeb"; -var systemAppCalleeBMainAbilityName = "com.example.systemappcalleeb.MainAbility"; -var systemAppCalleeBSecondAbilityName = "com.example.systemappcalleeb.SecondAbility"; - -var systemAppCalleeCBundleName = "com.example.systemappcalleec"; -var systemAppCalleeCMainAbilityName = "com.example.systemappcalleec.MainAbility"; -var systemAppCalleeCSecondAbilityName = "com.example.systemappcalleec.SecondAbility"; - -var thirdAppABundleName = "com.example.thirdappa"; -var thirdAppAMainAbilityName = "com.example.thirdappa.MainAbility"; -var subscriberInfo = { - events: ["CallTest"], -}; -var caseDepBundles = []; - -class MySequenceable { - num: number = 0; - str: String = "default"; - result: String = "default"; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function getMissionId(abilityName, state) { - return new Promise(async (resolve, reject) => { - let missionId = -1; - let missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); - for (let i = 0; i < missionInfos.length; i++) { - if ((missionInfos[i].want.abilityName == abilityName) - && (missionInfos[i].runningState == state)) { - missionId = missionInfos[i].missionId; - break; - } - } - console.log('======>getMissionId resolve missionId<=======' + missionId); - resolve(missionId); - }) -} - -function delay(time) { - let delta; - if (typeof time != 'number' || time <= 0) { - delta = 100; - } else { - delta = Math.round(time); - } - for (let start = Date.now(); Date.now() - start <= delta; ); -} - -function clearDepProcess(bundleNames, callback, undoneCallBack) { - var result; - var cnt = 0; - - if (bundleNames.length == 0) { - undoneCallBack(); - } - for (let i = 0; i < bundleNames.length; i++) { - result = appManager.killProcessesByBundleName(bundleNames[i], (err, data) => { - console.log("clearDepProcess killProcessesByBundleName bundleName: " + bundleNames[i]); - console.log("clearDepProcess killProcessesByBundleName err: " + JSON.stringify(err)); - console.log("clearDepProcess killProcessesByBundleName data: " + JSON.stringify(data)); - cnt++; - if (cnt == bundleNames.length) { - callback(); - } - }); - } -} - -export default function abilityTest(abilityContext) { - describe('ActsAbilityTest', function () { - - beforeEach(async (done) => { - done(); - }) - - afterEach(async (done) => { - var testMissionId; - - testMissionId = await getMissionId(sysAMainAbilityName, 0); - console.log('======>afterEach test missionId<=======' + testMissionId); - if (testMissionId != -1) { - await missionManager.moveMissionToFront(testMissionId); - } - console.log('======>afterEach test missionId move to front<======='); - - clearDepProcess(caseDepBundles, () => { - caseDepBundles = []; - setTimeout(() => { - done(); - }, 500) - }, () => { - done(); - }); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0100 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0100', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0100 begin'); - var subscriber; - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_0100 unSubscribeCallBack') - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0100 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_0100 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(100); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0100'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0100processed'); - console.log('AMS_CallTest_0100 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(100, "ACTS_CommonComponent_Call_0100", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_0100 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0100 call exception' + err); - expect().assertFail(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0200 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0200 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0200 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(200, "ACTS_CommonComponent_Call_0200", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_0200 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(200); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_0200'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_0200processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0200 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0300 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0300 begin'); - var subscriber; - caseDepBundles = [systemAppCalleeABundleName]; - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_0300 unSubscribeCallBack') - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0300 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_0300 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(300); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0300'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0300processed'); - console.log('ACTS_CommonComponent_Call_0300 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeAMainAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(300, "ACTS_CommonComponent_Call_0300", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_0300 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0300 call exception' + err); - expect().assertFail(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0400 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0400', 0, async function (done) { - caseDepBundles = [systemAppCalleeABundleName]; - console.log('ACTS_CommonComponent_Call_0400 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0400 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeAMainAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(400, "ACTS_CommonComponent_Call_0400", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_0400 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(400); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_0400'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_0400processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0400 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0500 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0500', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0500 begin'); - var subscriber; - var caller1; - var caller2; - caseDepBundles = [systemAppCalleeABundleName]; - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_0500 unSubscribeCallBack') - caller1.release(); - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0500 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_0500 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(500); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0500'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0500processed'); - console.log('ACTS_CommonComponent_Call_0500 do release'); - caller2.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - - caller1 = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeAMainAbilityName, - }); - - caller2 = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeASecondAbilityName, - }); - - caller2.onRelease(releaseCallback); - let param = new MySequenceable(500, "ACTS_CommonComponent_Call_0500", 'default'); - caller2.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_0500 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0500 call exception' + err); - expect().assertFail(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0600 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0600', 0, async function (done) { - caseDepBundles = [systemAppCalleeABundleName]; - console.log('ACTS_CommonComponent_Call_0600 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0600 releaseCallBack' + data); - caller1.release(); - done(); - } - - let caller1 = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeAMainAbilityName, - }); - let caller2 = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeASecondAbilityName, - }); - - caller2.onRelease(releaseCallback); - let param = new MySequenceable(600, "ACTS_CommonComponent_Call_0600", 'default'); - caller2.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_0600 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(600); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_0600'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_0600processed'); - caller2.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0600 call exception' + err); - expect().assertFail(); - caller2.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0700 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0700 begin'); - var subscriber; - var caller; - caseDepBundles = [systemAppCalleeABundleName]; - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_0700 unSubscribeCallBack') - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0700 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function releaseCallback1(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0700 releaseCallBack1' + data); - setTimeout(() => { - globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeASecondAbilityName, - }).then(data => { - caller = data; - console.log('ACTS_CommonComponent_Call_0700 caller get') - caller.onRelease(releaseCallback); - let param = new MySequenceable(700, "ACTS_CommonComponent_Call_0700", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_0700 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0700 call exception' + err); - expect().assertFail(); - }) - }) - }, 100); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_0700 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(700); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0700'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0700processed'); - console.log('ACTS_CommonComponent_Call_0700 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - - globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeASecondAbilityName, - }).then(data => { - caller = data; - console.log('ACTS_CommonComponent_Call_0700 caller get') - caller.onRelease(releaseCallback1); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0800 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0800 begin'); - var caller; - caseDepBundles = [systemAppCalleeABundleName]; - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0800 releaseCallBack' + data); - done(); - } - - function releaseCallback1(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0800 releaseCallBack' + data); - setTimeout(() => { - globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeASecondAbilityName, - }).then(data => { - caller = data; - caller.onRelease(releaseCallback); - let param = new MySequenceable(800, "ACTS_CommonComponent_Call_0800", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_0800 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(800); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_0800'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_0800processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0800 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }); - }, 100); - } - - globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeASecondAbilityName, - }).then(data => { - caller = data; - console.log('ACTS_CommonComponent_Call_0800 caller get') - caller.onRelease(releaseCallback1); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0900 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0900 begin'); - var subscriber; - caseDepBundles = [thirdAppABundleName]; - var caller; - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_0900 unSubscribeCallBack') - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0900 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_0900 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(900); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0900'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0900processed'); - console.log('AMS_CallTest_0100 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdAppABundleName, - abilityName: thirdAppAMainAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(900, "ACTS_CommonComponent_Call_0900", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_0900 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0900 call exception' + err); - expect().assertFail(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1000 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1000', 0, async function (done) { - caseDepBundles = [thirdAppABundleName]; - console.log('ACTS_CommonComponent_Call_1000 begin'); - var caller; - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1000 releaseCallBack' + data); - done(); - } - - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdAppABundleName, - abilityName: thirdAppAMainAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(1000, "ACTS_CommonComponent_Call_1000", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_1000 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(1000); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_1000'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_1000processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1000 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1700 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1700 begin'); - var caller; - var exceptionFlag = false; - - try { - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeAThirdAbilityName, - }); - } catch(err) { - console.log('ACTS_CommonComponent_Call_1700 exception' + err); - exceptionFlag = true; - expect(err.message).assertEqual("function request remote error"); - } - expect(exceptionFlag).assertEqual(true); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1900 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1900 begin'); - var subscriber; - var callBackCnt = 0; - - function checkFinish() { - if (callBackCnt >= 3) { - console.log('ACTS_CommonComponent_Call_1900 finish release') - caller.release(); - } - } - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_1900 unSubscribeCallBack') - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1900 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_1900 subscribeCallBack data:' + JSON.stringify(data)) - if (data.data == 'calleeCheckCallParam') { - expect(data.parameters.num).assertEqual(1900); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed'); - callBackCnt++; - checkFinish(); - } else if (data.data == 'calleeCheckCall2Param') { - expect(data.parameters.num).assertEqual(1900); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed2'); - callBackCnt++; - checkFinish(); - } - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(1900, "ACTS_CommonComponent_Call_1900", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_1900 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1900 call exception' + err); - expect().assertFail(); - }) - caller.call('testCall2', param).then(() => { - console.log('ACTS_CommonComponent_Call_1900 call2 success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1900 call2 exception' + err); - expect().assertFail(); - }) - - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_1900 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(1900); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_1900'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_1900processed'); - callBackCnt++; - checkFinish(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1900 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2000 - * @tc.name: The callee exits abnormally after the caller requests the call to be called successfully. - * @tc.desc: Verify that the caller can register the server's death listener. - */ - it('ACTS_CommonComponent_Call_2000', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2000 begin'); - - function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_2000 releaseCallBack:' + data); - expect(data).assertEqual("died"); - done(); - } - - let bundleNameCallee = "com.example.systemappcalleea"; - let abilityNameCallee = "com.example.systemappcalleea.MainAbility"; - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_2000 startAbilityByCall fail'); - expect().assertFail(); - } - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_2000 Caller onRelease fail ' + e); - expect().assertFail(); - } - await appManager.killProcessesByBundleName(bundleNameCallee); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2300 - * @tc.name: Callee is in standalone process AbilityStage of the same app. - * @tc.desc: Verify Callee is in standalone process AbilityStage of the same app. - */ - it('ACTS_CommonComponent_Call_2300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2300 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.second.MainAbility"; - - function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_2300 releaseCallBack:' + data); - expect(data).assertEqual("release"); - done(); - } - - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_2300 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_2300 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - let param = new MySequenceable(2300, "case2300", 'default'); - caller.callWithResult('test2300', param).then((data) => { - console.log('ACTS_CommonComponent_Call_2300 callWithResult ' + JSON.stringify(data)); - let result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.str).assertEqual("onCreateonBackground"); - expect(result.num).assertEqual(0); - }); - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_2300 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2400 - * @tc.name: The service party cannot provide the corresponding service after calling Callee.off. - * @tc.desc: The verification service party cannot provide the corresponding service after calling Callee.off. - */ - it('ACTS_CommonComponent_Call_2400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2400 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2400 releaseCallBack ' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2400, "case2400", 'default'); - let beforeOff = 0; - let afterOff = 0; - await caller.call('testOff', param).then(() => { - console.log('ACTS_CommonComponent_Call_2400 call success'); - beforeOff = 1; - }).catch(err => { - beforeOff = 2; - }) - - globalThis.secondCallee.off('testOff'); - - await caller.call('testOff', param).then(() => { - console.log('ACTS_CommonComponent_Call_2400 call success'); - afterOff = 1; - }).catch(err => { - afterOff = 2; - }) - - expect(beforeOff).assertEqual(1); - expect(afterOff).assertEqual(2); - caller.release(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2500 - * @tc.name: The parameter "method" of the Caller.call function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.call function is an empty string. - */ - it('ACTS_CommonComponent_Call_2500', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2500 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2500 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2500, "case2500", 'default'); - caller.call('', param).then(() => { - console.log('ACTS_CommonComponent_Call_2500 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2500 call exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2600 - * @tc.name: The parameter "method" of the Caller.call function is null. - * @tc.desc: Verify that the parameter "method" of the Caller.call function is null. - */ - it('ACTS_CommonComponent_Call_2600', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2600 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2600 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2600, "case2600", 'default'); - caller.call(null, param).then(() => { - console.log('ACTS_CommonComponent_Call_2600 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2600 call exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2700 - * @tc.name: The parameter "method" of the Caller.call function is undefined. - * @tc.desc: Verify that the parameter "method" of the Caller.call function is undefined. - */ - it('ACTS_CommonComponent_Call_2700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2700 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2700 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2700, "case2700", 'default'); - caller.call(undefined, param).then(() => { - console.log('ACTS_CommonComponent_Call_2700 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2700 call exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2800 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_2800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2800 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2800 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2800, "case2800", 'default'); - caller.callWithResult('', param).then((data) => { - console.log('ACTS_CommonComponent_Call_2800 callWithResult success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2800 callWithResult exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2900 - * @tc.name: The parameter "method" of the Caller.callWithResult function is null. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is null. - */ - it('ACTS_CommonComponent_Call_2900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2900 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2900 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2900, "case2900", 'default'); - caller.callWithResult(null, param).then((data) => { - console.log('ACTS_CommonComponent_Call_2900 callWithResult success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2900 callWithResult exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3000 - * @tc.name: The parameter "method" of the Caller.callWithResult function is undefined. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is undefined. - */ - it('ACTS_CommonComponent_Call_3000', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3000 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3000 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(3000, "case3000", 'default'); - caller.callWithResult(undefined, param).then((data) => { - console.log('ACTS_CommonComponent_Call_3000 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3000 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3100 - * @tc.name: The parameter method of the Callee.on function is an empty string. - * @tc.desc: Verify that the parameter method of the Callee.on function is an empty string. - */ - it('ACTS_CommonComponent_Call_3100', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3100 begin'); - - function onTest(data) { - console.log('ACTS_CommonComponent_Call_3100 onTest'); - } - - let finishFlag = 0; - try { - globalThis.callee.on('', onTest); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3200 - * @tc.name: The parameter method of the Callee.on function is null. - * @tc.desc: Verify that the parameter method of the Callee.on function is null. - */ - it('ACTS_CommonComponent_Call_3200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3200 begin'); - - function onTest(data) { - console.log('ACTS_CommonComponent_Call_3200 onTest'); - } - - let finishFlag = 0; - try { - globalThis.callee.on(null, onTest); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3300 - * @tc.name: The parameter method of the Caller.callWithResult function is undefined. - * @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined. - */ - it('ACTS_CommonComponent_Call_3300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3300 begin'); - - function onTest(data) { - console.log('ACTS_CommonComponent_Call_3300 onTest'); - } - - let finishFlag = 0; - try { - globalThis.callee.on(undefined, onTest); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3400 - * @tc.name: The parameter "method" of the Callee.off function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string. - */ - it('ACTS_CommonComponent_Call_3400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3400 begin'); - - let finishFlag = 0; - try { - globalThis.callee.off(''); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3500 - * @tc.name: The parameter "method" of the Callee.off function is null. - * @tc.desc: Verify that the parameter "method" of the Callee.off function is null. - */ - it('ACTS_CommonComponent_Call_3500', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3500 begin'); - - let finishFlag = 0; - try { - globalThis.callee.off(null); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3600 - * @tc.name: The parameter “method” of the Callee.off function is undefined. - * @tc.desc: Verify that the parameter “method” of the Callee.off function is undefined. - */ - it('ACTS_CommonComponent_Call_3600', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3600 begin'); - - let finishFlag = 0; - try { - globalThis.callee.off(undefined); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3600 callee.off err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_3700 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_3700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3700 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3700 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - console.log('ACTS_CommonComponent_Call_3700 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_3700 before call') - caller.call('testCall', "").then(() => { - console.log('ACTS_CommonComponent_Call_3700 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3700 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_3800 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_3800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3800 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3800 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - console.log('ACTS_CommonComponent_Call_3800 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_3800 before call') - caller.call('testCall', null).then(() => { - console.log('ACTS_CommonComponent_Call_3800 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3800 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_3900 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_3900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3900 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3900 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - console.log('ACTS_CommonComponent_Call_3900 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_3900 before call') - caller.call('testCall', undefined).then(() => { - console.log('ACTS_CommonComponent_Call_3900 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3900 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4000 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4000', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4000 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4000 release CallBack' + data); - done(); - } - - globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - let caller = data; - console.log('ACTS_CommonComponent_Call_4000 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4000 before call') - caller.callWithResult('testCallWithResult', "").then((data) => { - console.log('ACTS_CommonComponent_Call_4000 call success'); - expect(data).assertEqual(undefined); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4000 call err' + e); - caller.release(); - }); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4100 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4100', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4100 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4100 release CallBack' + data); - done(); - } - - globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - let caller = data; - console.log('ACTS_CommonComponent_Call_4100 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4100 before call') - caller.callWithResult('testCallWithResult', null).then((data) => { - console.log('ACTS_CommonComponent_Call_4100 call success'); - expect(data).assertEqual(undefined); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4100 call err' + e); - caller.release(); - }); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4200 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4200 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4200 release CallBack' + data); - done(); - } - - globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - let caller = data; - console.log('ACTS_CommonComponent_Call_4200 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4200 before call') - caller.callWithResult('testCallWithResult', undefined).then((data) => { - console.log('ACTS_CommonComponent_Call_4200 call success'); - expect(data).assertEqual(undefined); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4200 call err' + e); - caller.release(); - }); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4300 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4300 begin'); - let finishFlag = 0; - try { - globalThis.callee.on('testCall', ""); - } catch (err) { - console.log('ACTS_CommonComponent_Call_4300 call err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4400 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4400 begin'); - let finishFlag = 0; - try { - globalThis.callee.on('testCall', null); - } catch (err) { - console.log('ACTS_CommonComponent_Call_4400 call err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4500 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4500', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4500 begin'); - let finishFlag = 0; - try { - globalThis.callee.on('testCall', undefined); - } catch (err) { - console.log('ACTS_CommonComponent_Call_4500 call err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_4800 - * @tc.name: Callee is in standalone process AbilityStage of the same app. - * @tc.desc: Verify Callee is in standalone process AbilityStage of the same app. - */ - it('ACTS_CommonComponent_Call_4800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4800 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.second.MainAbility"; - - function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_4800 releaseCallBack:' + data); - expect(data).assertEqual("release"); - done(); - } - - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_4800 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_4800 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - let param = new MySequenceable(4600, "case4600", 'default'); - caller.callWithResult('test4600', param).then((data) => { - let result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.str).assertEqual("onCreateonBackground"); - expect(result.num).assertEqual(0); - }); - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_4800 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4900 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4900 begin'); - let caller; - let sequenceable = new MySequenceable(1, 'ACTS_CommonComponent_Call_4900', 'default'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4900 releaseCallBack ' + data); - caller.call('testCall', sequenceable).then(() => { - console.log('ACTS_CommonComponent_Call_4900 call2 success'); - expect().assertFail(); - done(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_4900 call2 err ' + err); - expect(err.message).assertEqual("function inner object error"); - done(); - }) - } - - globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - caller = data; - console.log('ACTS_CommonComponent_Call_4900 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4900 before call') - delay(100); - caller.call('testCall', sequenceable).then(() => { - console.log('ACTS_CommonComponent_Call_4900 call1 success'); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4900 call err' + e); - expect().assertFail(); - done(); - }); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_5000 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_5000', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5000 begin'); - let finishFlag = 0; - - function testCallback_5100() { - console.log('ACTS_CommonComponent_Call_5000 testCallback'); - } - - try { - globalThis.callee.on('ACTS_CommonComponent_Call_5000', testCallback_5100); - } catch (err) { - console.log('ACTS_CommonComponent_Call_5000 call err' + err); - expect().assertFail(); - globalThis.callee.off('ACTS_CommonComponent_Call_5000'); - done(); - } - try { - globalThis.callee.on('ACTS_CommonComponent_Call_5000', testCallback_5100); - } catch (err) { - console.log('ACTS_CommonComponent_Call_5000 call err' + err); - expect(err.message).assertEqual("function is registered"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - globalThis.callee.off('ACTS_CommonComponent_Call_5000'); - console.log('ACTS_CommonComponent_Call_5000 finished'); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_5100 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_5100', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5100 begin'); - let finishFlag = 0; - - function testCallback_5100() { - console.log('ACTS_CommonComponent_Call_5100 testCallback'); - } - - try { - globalThis.callee.on('ACTS_CommonComponent_Call_5100', testCallback_5100); - globalThis.callee.off('ACTS_CommonComponent_Call_5100'); - } catch (err) { - console.log('ACTS_CommonComponent_Call_5100 first step err' + err); - expect().assertFail(); - globalThis.callee.off('ACTS_CommonComponent_Call_5100'); - done(); - } - try { - globalThis.callee.off('ACTS_CommonComponent_Call_5100'); - } catch (err) { - console.log('ACTS_CommonComponent_Call_5100 call err' + err); - expect(err.message).assertEqual("function not registered"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - console.log('ACTS_CommonComponent_Call_5100 finished'); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_5200 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_5200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5200 begin'); - let caller; - let exceptionFlag = false; - - try { - caller = await globalThis.abilityContext.startAbilityByCall(null); - console.log('ACTS_CommonComponent_Call_5200 startAbilityByCall' + JSON.stringify(caller)) - } catch(err) { - console.log('ACTS_CommonComponent_Call_5200 exception' + err); - exceptionFlag = true; - expect(err.message).assertEqual("function input parameter error"); - } - - expect(exceptionFlag).assertEqual(true); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_5300 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_5300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5300 begin'); - let caller; - let exceptionFlag = false; - - try { - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: "", - abilityName: "", - }); - console.log('ACTS_CommonComponent_Call_5300 startAbilityByCall' + JSON.stringify(caller)) - } catch(err) { - console.log('ACTS_CommonComponent_Call_5300 exception' + err); - exceptionFlag = true; - expect(err.message).assertEqual("function request remote error"); - } - - expect(exceptionFlag).assertEqual(true); - done(); - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_5400 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_5400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5400 begin'); - let caller; - let exceptionFlag = false; - - try { - caller = await globalThis.abilityContext.startAbilityByCall(undefined); - console.log('ACTS_CommonComponent_Call_5400 startAbilityByCall' + JSON.stringify(caller)) - } catch(err) { - console.log('ACTS_CommonComponent_Call_5400 exception' + err); - exceptionFlag = true; - expect(err.message).assertEqual("function input parameter error"); - } - - expect(exceptionFlag).assertEqual(true); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_5700 - * @tc.name: The mission of callee is not in recent list when startAbilityByCall only. - * @tc.desc: Verify the mission of callee is not in recent list when startAbilityByCall only. - */ - it('ACTS_CommonComponent_Call_5700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5700 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.systemcalltest.SecondAbility"; - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_5700 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - async function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_5700 releaseCallBack:' + data); - expect(data).assertEqual("release"); - - let missionId = await getMissionId(abilityNameCallee, 0); - expect(missionId == -1).assertTrue(); - done(); - } - - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5700 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_5800 - * @tc.name: The mission of callee is in recent list when startAbilityByCall then startAbility. - * @tc.desc: Verify the mission of callee is in recent list when startAbilityByCall then startAbility. - */ - it('ACTS_CommonComponent_Call_5800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5800 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.systemcalltest.SecondAbility"; - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_5800 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - function startAbilityCallback(err) { - console.log('ACTS_CommonComponent_Call_5800 startAbilityCallback'); - if (err.code != 0) { - expect().assertFail(); - done(); - } - } - - await globalThis.abilityContext.startAbility(want, startAbilityCallback); - - async function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_5800 releaseCallBack:' + data); - expect(data).assertEqual("release"); - - let missionId = await getMissionId(abilityNameCallee, 0); - expect(missionId != -1).assertTrue(); - done(); - } - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5800 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/pages/second/second.ets b/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/pages/second/second.ets deleted file mode 100755 index 72e66614c1a8c9068b0b0594d6da4ae52c0912b7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/pages/second/second.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('SystemCallTest SecondAbility)') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/Test.json b/aafwk/aafwk_standard/actscalltest/thirdcalltest/Test.json deleted file mode 100755 index be829fa64d2f0de17aed753a31a013505eb5a561..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/thirdcalltest/Test.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.example.thirdcalltest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsThirdCallTest.hap", - "ActsSystemAppCalleeARelyHap.hap", - "ActsThirdAppARelyHap.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/FifthAbility/FifthAbility.ts b/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/FifthAbility/FifthAbility.ts deleted file mode 100755 index 598552ba1ad34790f70d58abcbd0735b7e6fbcc3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/FifthAbility/FifthAbility.ts +++ /dev/null @@ -1,124 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest FifthAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA FifthAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest FifthAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class FifthAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemCallTest FifthAbility onCreate") - globalThis.abilityWant = want; - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemCallTest FifthAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemCallTest FifthAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/second/second", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemCallTest FifthAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemCallTest FifthAbility onForeground") - if ((globalThis.abilityWant.parameters.case_num == "case1300") || - (globalThis.abilityWant.parameters.case_num == "case1400")) { - var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; - var commonEventData = { - data: publishData, - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>SystemAppCallerA FifthAbility Call_Finish<======') - }) - } - } - - onBackground() { - // Ability has back to background - console.log("SystemCallTest FifthAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/ForthAbility/ForthAbility.ts b/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/ForthAbility/ForthAbility.ts deleted file mode 100755 index 325cf4b41c4ba6200d53ece07b0f4105f12d681c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/ForthAbility/ForthAbility.ts +++ /dev/null @@ -1,124 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest ForthAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA ForthAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest ForthAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class ForthAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemCallTest ForthAbility onCreate") - globalThis.abilityWant = want; - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemCallTest ForthAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemCallTest ForthAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/second/second", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemCallTest ForthAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemCallTest ForthAbility onForeground") - if ((globalThis.abilityWant.parameters.case_num == "case1300") || - (globalThis.abilityWant.parameters.case_num == "case1400")) { - var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; - var commonEventData = { - data: publishData, - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>SystemAppCallerA ForthAbility Call_Finish<======') - }) - } - } - - onBackground() { - // Ability has back to background - console.log("SystemCallTest ForthAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/SecondAbility/SecondAbility.ts b/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/SecondAbility/SecondAbility.ts deleted file mode 100755 index 8438a2192682cacd7ba4f2c14ef5a0136517fad2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ /dev/null @@ -1,124 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA SecondAbility Call_Finish<======') - }) - return recvSequence; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest SecondAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class SecondAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemCallTest SecondAbility onCreate") - globalThis.abilityWant = want; - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemCallTest SecondAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemCallTest SecondAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/second/second", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemCallTest SecondAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemCallTest SecondAbility onForeground") - if ((globalThis.abilityWant.parameters.case_num == "case1300") || - (globalThis.abilityWant.parameters.case_num == "case1400")) { - var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; - var commonEventData = { - data: publishData, - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>SystemAppCallerA SecondAbility Call_Finish<======') - }) - } - } - - onBackground() { - // Ability has back to background - console.log("SystemCallTest SecondAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/ThirdAbility/ThirdAbility.ts deleted file mode 100755 index 4c0685e63f78b14ae70cec2340c95c852f52ba10..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/ThirdAbility/ThirdAbility.ts +++ /dev/null @@ -1,124 +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' -import commonEvent from '@ohos.commonEvent' - -class MySequenceable { - num: number = 0; - str: String = ""; - result: String = ""; - - constructor(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - setMySequence(num, string, result) { - this.num = num; - this.str = string; - this.result = result; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - messageParcel.writeString(this.result); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - this.result = messageParcel.readString(); - return true; - } -} - -function testCall(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest ThirdAbility on testCall <======') - data.readSequenceable(recvSequence); - var result = recvSequence.str + 'processed'; - var commonEventData = { - code: 0, - data: 'calleeCheckCallParam', - parameters: { - num: recvSequence.num, - str: recvSequence.str, - result: result - } - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>CallTestSysA ThirdAbility Call_Finish<======') - }) - return; -} - -function testCallWithResult(data) { - let recvSequence = new MySequenceable(0, '', ''); - console.log('======>SystemCallTest ThirdAbility on testCall <======') - data.readSequenceable(recvSequence); - let result = recvSequence.str + 'processed'; - recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); - - return recvSequence; -} - -export default class ThirdAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SystemCallTest ThirdAbility onCreate") - globalThis.abilityWant = want; - this.callee.on('testCall', testCall); - this.callee.on('testCallWithResult', testCallWithResult); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SystemCallTest ThirdAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SystemCallTest ThirdAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/second/second", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SystemCallTest ThirdAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SystemCallTest ThirdAbility onForeground") - if ((globalThis.abilityWant.parameters.case_num == "case1300") || - (globalThis.abilityWant.parameters.case_num == "case1400")) { - var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; - var commonEventData = { - data: publishData, - } - commonEvent.publish('CallTest', commonEventData, (err) => { - console.log('======>SystemAppCallerA ThirdAbility Call_Finish<======') - }) - } - } - - onBackground() { - // Ability has back to background - console.log("SystemCallTest ThirdAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 26746b5a84730dfe5b9220652170de21d515737f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 10000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts b/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts deleted file mode 100644 index bc472bcb26f454ccd2a9413f3a69a9ee3526bb69..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts +++ /dev/null @@ -1,253 +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 dataAbility from '@ohos.data.dataability' -import featureAbility from '@ohos.ability.featureAbility' -import fileio from '@ohos.fileio' -import dataRdb from '@ohos.data.rdb' - -const TABLE_NAME = 'book' -const STORE_CONFIG = { name: 'book.db', encryptKey: new Uint8Array([]) } -const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book' + - '(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER, introduction TEXT NOT NULL)' -let rdbStore: any = undefined -const TAG = 'ACTS_ DataAbility.data' - -let defaultReturn = 1; -let returnError = 0; -let returnError1 = -1; -let returnError2 = -2; -let returnError3 = -3; -let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility"); - -export default { - - onInitialized(abilityInfo) { - console.debug('ACTS_ DataAbility onInitialized,abilityInfo=' + abilityInfo.bundleName) - dataRdb.getRdbStore(STORE_CONFIG, 1, (err, store) => { - console.debug('ACTS_ [data]getRdbStoreThen') - store.executeSql(SQL_CREATE_TABLE, []) - rdbStore = store - }); - }, - - insert(uri, valueBucket, callback) { - console.debug(TAG + ' insert start 1121') - console.debug(TAG + ' valueBucket json=>' + JSON.stringify(valueBucket)) - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) - console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) - console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) - if (valueBucket.age != 24) { - err = "Error age" - callback(err, returnError2); - } - if (valueBucket.name != "ActsDataAbilityHelperTest") { - err = "Error name" - callback(err, returnError2); - } - if (valueBucket.salary != 2024.20) { - err = "Error salary" - callback(err, returnError2); - } - - err = "Error insert" - console.debug(TAG + ' rdbStore.insert ') - rdbStore.insert(TABLE_NAME, valueBucket, function (err, resultSet) { - console.log(TAG + "insert callback resultSet:" + resultSet - + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) - callback(err, defaultReturn); - }) - }, - - query(uri, columns, predicates, callback) { - console.debug(TAG + ' query start') - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) - rdbStore.query(rdbPredicates, columns, callback) - }, - - update(uri, valueBucket, predicates, callback) { - console.debug(TAG + 'update start') - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) - console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) - console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) - if (valueBucket.age != 24) { - err = "Error age" - callback(err, returnError2); - } - if (valueBucket.name != "ActsDataAbilityHelperTest") { - err = "Error name" - callback(err, returnError2); - } - if (valueBucket.salary != 2024.20) { - err = "Error salary" - callback(err, returnError2); - } - - err = "Error update" - let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) - rdbStore.update(valueBucket, rdbPredicates, function (err, resultSet) { - console.log(TAG + "insert callback resultSet:" + resultSet - + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) - callback(err, defaultReturn); - }) - }, - - delete(uri, predicates, callback) { - console.debug(TAG + 'delete start') - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) - rdbStore.delete(rdbPredicates, function (err, resultSet) { - console.log(TAG + "insert callback resultSet:" + resultSet - + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) - callback(err, defaultReturn); - }) - }, - call(uri, method, arg, extras, callback) { - console.debug(TAG + 'call start') - console.debug(TAG + 'uri---->' + uri) - console.debug(TAG + 'method---->' + uri) - }, - - batchInsert(uri, values, callback) { - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - for (var j = 0; j < values.length; j++) { - rdbStore.insert("EMPLOYEE", values[j], function (err, ret) { - console.log(TAG + "batchInsert callback ret:" + JSON.stringify(ret)) - }) - } - console.log(TAG + "batchInsert values.length:" + values.length + ' ,json=' + JSON.stringify(values.length)) - callback(err, values.length); - }, - - getType(uri, callback) { - console.info(TAG + '==================== DataAbility test interface by getType ================'); - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - callback("success", uri); - }, - - getFileTypes(uri, mimeTypeFilter, callback) { - console.info(TAG + '==================== DataAbility test interface by GetFileTypes ================'); - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - let type1 = " "; - let type2 = " "; - let type3 = " "; - let types; - if (mimeTypeFilter == "*/*") { - type1 = ("hap"); - type2 = ("jpg"); - type3 = ("image/png"); - types = [type1, type2, type3]; - } else if (mimeTypeFilter == "image/*") { - type1 = ("image/png"); - types = [type1]; - } else if (mimeTypeFilter == "*/jpg") { - type1 = ("jpg"); - types = [type1]; - } - - console.log(TAG + "GetFileTypes callback ret:" + JSON.stringify(types)) - callback("success", types); - }, - - openFile(uri, mode, callback) { - console.info(TAG + '==================== DataAbility test interface by openFile ================'); - let defaultReturn = 1; - let returnError1 = -1; - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - if (!(mode == ("r") || mode == ("w") || mode == ("wt") || mode == ("wa") || - mode == ("rw") || mode == ("rwt"))) { - if (mode == ("A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7")) { - defaultReturn = returnError2; - } else - defaultReturn = returnError3; - } - console.info(TAG + " path = /data/test "); - let path = "/data/test" - fileio.stat(path).then(function (stat) { - console.info(TAG + "openFile getFileInfo successfully callback ret:" + JSON.stringify(stat)); - }).catch(function (err) { - console.info(TAG + "openFile getFileInfo failed with error callback ret:" + err); - defaultReturn = returnError1; - }); - console.info(TAG + " path ==>" + path); - callback("success", defaultReturn); - }, - - normalizeUri(uri, callback) { - console.info(TAG + '==================== DataAbility test interface by normalizeUri ================'); - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, ""); - } - callback("success", uri); - }, - - denormalizeUri(uri, callback) { - console.info(TAG + '==================== DataAbility test interface by denormalizeUri ================'); - console.info(TAG + "denormalizeUri uri:" + JSON.stringify(uri)); - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, ""); - } - callback("success", uri); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts b/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts deleted file mode 100644 index 1efa7ced163d2d4edca3c4b7ad3c695babb1a888..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts +++ /dev/null @@ -1,253 +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 dataAbility from '@ohos.data.dataability' -import featureAbility from '@ohos.ability.featureAbility' -import fileio from '@ohos.fileio' -import dataRdb from '@ohos.data.rdb' - -const TABLE_NAME = 'book' -const STORE_CONFIG = { name: 'book.db', encryptKey: new Uint8Array([]) } -const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book' + - '(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER, introduction TEXT NOT NULL)' -let rdbStore: any = undefined -const TAG = 'ACTS_ DataAbility.data' - -let defaultReturn = 1; -let returnError = 0; -let returnError1 = -1; -let returnError2 = -2; -let returnError3 = -3; -let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility2"); - -export default { - - onInitialized(abilityInfo) { - console.debug('ACTS_ DataAbility onInitialized,abilityInfo=' + abilityInfo.bundleName) - dataRdb.getRdbStore(STORE_CONFIG, 1, (err, store) => { - console.debug('ACTS_ [data]getRdbStoreThen') - store.executeSql(SQL_CREATE_TABLE, []) - rdbStore = store - }); - }, - - insert(uri, valueBucket, callback) { - console.debug(TAG + ' insert start 1121') - console.debug(TAG + ' valueBucket json=>' + JSON.stringify(valueBucket)) - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) - console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) - console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) - if (valueBucket.age != 24) { - err = "Error age" - callback(err, returnError2); - } - if (valueBucket.name != "ActsDataAbilityHelperTest") { - err = "Error name" - callback(err, returnError2); - } - if (valueBucket.salary != 2024.20) { - err = "Error salary" - callback(err, returnError2); - } - - err = "Error insert" - console.debug(TAG + ' rdbStore.insert ') - rdbStore.insert(TABLE_NAME, valueBucket, function (err, resultSet) { - console.log(TAG + "insert callback resultSet:" + resultSet - + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) - callback(err, defaultReturn); - }) - }, - - query(uri, columns, predicates, callback) { - console.debug(TAG + ' query start') - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) - rdbStore.query(rdbPredicates, columns, callback) - }, - - update(uri, valueBucket, predicates, callback) { - console.debug(TAG + 'update start') - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) - console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) - console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) - if (valueBucket.age != 24) { - err = "Error age" - callback(err, returnError2); - } - if (valueBucket.name != "ActsDataAbilityHelperTest") { - err = "Error name" - callback(err, returnError2); - } - if (valueBucket.salary != 2024.20) { - err = "Error salary" - callback(err, returnError2); - } - - err = "Error update" - let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) - rdbStore.update(valueBucket, rdbPredicates, function (err, resultSet) { - console.log(TAG + "insert callback resultSet:" + resultSet - + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) - callback(err, defaultReturn); - }) - }, - - delete(uri, predicates, callback) { - console.debug(TAG + 'delete start') - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) - rdbStore.delete(rdbPredicates, function (err, resultSet) { - console.log(TAG + "insert callback resultSet:" + resultSet - + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) - callback(err, defaultReturn); - }) - }, - call(uri, method, arg, extras, callback) { - console.debug(TAG + 'call start') - console.debug(TAG + 'uri---->' + uri) - console.debug(TAG + 'method---->' + uri) - }, - - batchInsert(uri, values, callback) { - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - - for (var j = 0; j < values.length; j++) { - rdbStore.insert("EMPLOYEE", values[j], function (err, ret) { - console.log(TAG + "batchInsert callback ret:" + JSON.stringify(ret)) - }) - } - console.log(TAG + "batchInsert values.length:" + values.length + ' ,json=' + JSON.stringify(values.length)) - callback(err, values.length); - }, - - getType(uri, callback) { - console.info(TAG + '==================== DataAbility test interface by getType ================'); - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - callback("success", uri); - }, - - getFileTypes(uri, mimeTypeFilter, callback) { - console.info(TAG + '==================== DataAbility test interface by GetFileTypes ================'); - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - let type1 = " "; - let type2 = " "; - let type3 = " "; - let types; - if (mimeTypeFilter == "*/*") { - type1 = ("hap"); - type2 = ("jpg"); - type3 = ("image/png"); - types = [type1, type2, type3]; - } else if (mimeTypeFilter == "image/*") { - type1 = ("image/png"); - types = [type1]; - } else if (mimeTypeFilter == "*/jpg") { - type1 = ("jpg"); - types = [type1]; - } - - console.log(TAG + "GetFileTypes callback ret:" + JSON.stringify(types)) - callback("success", types); - }, - - openFile(uri, mode, callback) { - console.info(TAG + '==================== DataAbility test interface by openFile ================'); - let defaultReturn = 1; - let returnError1 = -1; - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, returnError1); - } - if (!(mode == ("r") || mode == ("w") || mode == ("wt") || mode == ("wa") || - mode == ("rw") || mode == ("rwt"))) { - if (mode == ("A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7")) { - defaultReturn = returnError2; - } else - defaultReturn = returnError3; - } - console.info(TAG + " path = /data/test "); - let path = "/data/test" - fileio.stat(path).then(function (stat) { - console.info(TAG + "openFile getFileInfo successfully callback ret:" + JSON.stringify(stat)); - }).catch(function (err) { - console.info(TAG + "openFile getFileInfo failed with error callback ret:" + err); - defaultReturn = returnError1; - }); - console.info(TAG + " path ==>" + path); - callback("success", defaultReturn); - }, - - normalizeUri(uri, callback) { - console.info(TAG + '==================== DataAbility test interface by normalizeUri ================'); - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, ""); - } - callback("success", uri); - }, - - denormalizeUri(uri, callback) { - console.info(TAG + '==================== DataAbility test interface by denormalizeUri ================'); - console.info(TAG + "denormalizeUri uri:" + JSON.stringify(uri)); - - let err = "Error Uri" - if (uri != dataAbilityUri) { - console.debug(TAG + ' uri != dataAbilityUri') - callback(err, ""); - } - callback("success", uri); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js b/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js deleted file mode 100644 index 0831dc042aaf302af040548463c7ae513a61dc87..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js +++ /dev/null @@ -1,8525 +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 featureAbility from '@ohos.ability.featureAbility' -import ohosDataAbility from '@ohos.data.dataability' - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsDataAbilityHelperTest', function () { - let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility"); - let dataAbilityUri2 = ("dataability:///com.example.myapplication.DataAbility2"); - let dataAbilityUri3 = ("dataability:///com.example.myapplication.DataAbility3"); - let DAHelper; - let gSetTimeout = 500; - var valueBucket = { - "name": "ActsDataAbilityHelperTest", - "age": 24, - "salary": 2024.20, - } - - beforeAll(async (done) => { - console.debug('= ACTS_beforeAll ====: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); - if(DAHelper == null){ - console.debug('ACTS_beforeAll DAHelper ====>: DAHelper == null'); - } - } catch (err) { - console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); - } - console.debug('= ACTS_beforeAll ==== { - console.debug('= ACTS_afterAll ====" + dataAbilityUri) - try { - var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) - console.log('ACTS_AcquireDataAbilityHelper_0100 abilityHelper ====>: ' - + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) - if(DAHelper == null){ - DAHelper = abilityHelper; - } - expect(typeof (abilityHelper)).assertEqual("object"); - } catch (err) { - console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:' + err); - expect(false).assertTrue(); - } - done(); - console.log('ACTS_AcquireDataAbilityHelper_0100====: ' - + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) - expect(abilityHelper).assertEqual(null); - } catch (err) { - console.error('=ACTS_GetDataAbilityHelper_0200 acquireDataAbilityHelper catch(err)====>:' + err); - expect(false).assertTrue(); - } - done(); - console.log('ACTS_AcquireDataAbilityHelper_0200====: ' - + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) - expect(abilityHelper).assertEqual(null); - } catch (err) { - console.error('=ACTS_GetDataAbilityHelper_0300 acquireDataAbilityHelper catch(err)====>:' + err); - expect(false).assertTrue(); - } - done(); - console.log('ACTS_AcquireDataAbilityHelper_0300====: ' - + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) - expect(JSON.stringify(abilityHelper)).assertEqual("null"); - } catch (err) { - console.error('=ACTS_GetDataAbilityHelper_0400 acquireDataAbilityHelper catch(err)====>:' + err); - expect(false).assertTrue(); - } - done(); - console.log('ACTS_AcquireDataAbilityHelper_0400====: ' - + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) - expect(JSON.stringify(abilityHelper)).assertEqual("null"); - } catch (err) { - console.error('=ACTS_GetDataAbilityHelper_0500 acquireDataAbilityHelper catch(err)====>:' + err); - expect(false).assertTrue(); - } - done(); - console.log('ACTS_AcquireDataAbilityHelper_0500====: ' + DAHelper) - let valueBucketM - try { - DAHelper.insert(dataAbilityUri, valueBucketM) - .then(function (data) { - console.debug("=ACTS_Insert_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-2); - console.log('ACTS_Insert_0100====" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Insert_0100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Insert_0100====: ' + DAHelper) - let valueBucketM = 'undefined'; - try { - await DAHelper.insert(dataAbilityUri, valueBucketM, - (err, data) => { - console.debug("=ACTS_Insert_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】data【") + data + (" 】;")); - expect(data).assertEqual(-2); - console.log('ACTS_Insert_0200====:' + err); - console.log('ACTS_Insert_0200==== { - console.debug("=ACTS_Insert_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - console.log('ACTS_Insert_0300==== { - console.debug("=ACTS_Insert_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_0300====:' + err); - console.log('ACTS_Insert_0300====: ' + DAHelper) - try { - await DAHelper.insert(dataAbilityUri, valueBucket, - (err, data) => { - console.debug("=ACTS_Insert_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - console.log('ACTS_Insert_0400====:' + err); - console.log('ACTS_Insert_0400==== { - console.debug("=ACTS_Insert_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_Insert_0500==== { - console.debug("=ACTS_Insert_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_0500====:' + err); - console.log('ACTS_Insert_0500====: ' + DAHelper) - try { - await DAHelper.insert(undefined, valueBucket, - (err, data) => { - console.debug("=ACTS_Insert_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - expect(data).assertEqual(0); - console.log('ACTS_Insert_0600====:' + err); - console.log('ACTS_Insert_0600==== { - console.debug("=ACTS_Insert_0700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_Insert_0700==== { - console.debug("=ACTS_Insert_0700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_0700====:' + err); - console.log('ACTS_Insert_0700====: ' + DAHelper) - var currentAlertTimeout; - try { - function onAsyncCallbackInsert0800(err) { - clearTimeout(currentAlertTimeout); - expect(err.code).assertEqual(0); - console.log('ACTS_Insert_0800==== { - console.debug("=ACTS_Insert_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_Insert_0800====:' + err); - console.log('ACTS_Insert_0800==== { - console.debug("=ACTS_Insert_0900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_Insert_0900==== { - console.debug("=ACTS_Insert_0900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_0900====:' + err); - console.log('ACTS_Insert_0900====: ' + DAHelper) - try { - await DAHelper.insert(123456, valueBucket, - (err, data) => { - console.debug("=ACTS_Insert_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - expect(data).assertEqual(0); - console.log('ACTS_Insert_1000====:' + err); - console.log('ACTS_Insert_1000==== { - console.debug("=ACTS_Insert_1100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_Insert_1100==== { - console.debug("=ACTS_Insert_1100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_1100====:' + err); - console.log('ACTS_Insert_1100====: ' + DAHelper) - try { - await DAHelper.insert(dataAbilityUri2, valueBucket, - (err, data) => { - console.debug("=ACTS_Insert_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_Insert_1200====:' + err); - console.log('ACTS_Insert_1200==== { - console.debug("=ACTS_Insert_1300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_Insert_1300==== { - console.debug("=ACTS_Insert_1300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_1300====:' + err); - console.log('ACTS_Insert_1300====: ' + DAHelper) - try { - await DAHelper.insert("errorUri", valueBucket, - (err, data) => { - console.debug("=ACTS_Insert_1400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_Insert_1400====:' + err); - console.log('ACTS_Insert_1400==== { - console.debug("=ACTS_Insert_1500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-2); - console.log('ACTS_Insert_1500==== { - console.debug("=ACTS_Insert_1500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Insert_1500====:' + err); - console.log('ACTS_Insert_1500====: ' + DAHelper) - var valueBucketK = {}; - try { - await DAHelper.insert(dataAbilityUri, valueBucketK, - (err, data) => { - console.debug("=ACTS_Insert_1600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-2); - console.log('ACTS_Insert_1600====:' + err); - console.log('ACTS_Insert_1600====: ' + DAHelper) - var valueBucketM; - try { - DAHelper.batchInsert( - dataAbilityUri, - valueBucketM - ).then((data) => { - console.debug("=ACTS_BatchInsert_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); - expect(data).assertEqual(0); - console.log('ACTS_BatchInsert_0100==== { - console.debug("=ACTS_BatchInsert_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_0100====:' + err); - console.log('ACTS_BatchInsert_0100====: ' + DAHelper) - var valueBucketM; - try { - await DAHelper.batchInsert( - dataAbilityUri, - valueBucketM, - (err, data) => { - console.debug("=ACTS_BatchInsert_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(0); - console.log('ACTS_BatchInsert_0200====:' + err); - console.log('ACTS_BatchInsert_0200====: ' + DAHelper) - var valueBucketArray = new Array({}, {}, {}) - try { - DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); - expect(data).assertEqual(3); - console.log('ACTS_BatchInsert_0300==== { - console.debug("=ACTS_BatchInsert_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_0300====:' + err); - console.log('ACTS_BatchInsert_0300====: ' + DAHelper) - var valueBucketArray = new Array({}, {}, {}) - try { - await DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - (err, data) => { - console.debug("=ACTS_BatchInsert_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(3); - console.log('ACTS_BatchInsert_0400====:' + err); - console.log('ACTS_BatchInsert_0400====: ' + DAHelper) - try { - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - - DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(3); - console.log('ACTS_BatchInsert_0500==== { - console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_0500====:' + err); - console.log('ACTS_BatchInsert_0500====: ' + DAHelper) - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - try { - await DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - (err, data) => { - console.debug("=ACTS_BatchInsert_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(3); - console.log('ACTS_BatchInsert_0600====:' + err); - console.log('ACTS_BatchInsert_0600====: ' + DAHelper) - try { - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - - DAHelper.batchInsert( - dataAbilityUri2, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_0700 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_BatchInsert_0700==== { - console.debug("=ACTS_BatchInsert_0700 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_0700====:' + err); - console.log('ACTS_BatchInsert_0700====: ' + DAHelper) - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - try { - await DAHelper.batchInsert( - dataAbilityUri2, - valueBucketArray, - (err, data) => { - console.debug("=ACTS_BatchInsert_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_BatchInsert_0800====:' + err); - console.log('ACTS_BatchInsert_0800====: ' + DAHelper) - try { - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - - DAHelper.batchInsert( - undefined, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_0900 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_BatchInsert_0900==== { - console.debug("=ACTS_BatchInsert_0900 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_0900====:' + err); - console.log('ACTS_BatchInsert_0900====: ' + DAHelper) - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - try { - await DAHelper.batchInsert( - undefined, - valueBucketArray, - (err, data) => { - console.debug("=ACTS_BatchInsert_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - console.log('ACTS_BatchInsert_1000====:' + err); - console.log('ACTS_BatchInsert_1000====: ' + DAHelper) - try { - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - - DAHelper.batchInsert( - "error", - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_1100 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_BatchInsert_1100==== { - console.debug("=ACTS_BatchInsert_1100 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_1100====:' + err); - console.log('ACTS_BatchInsert_1100====: ' + DAHelper) - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - try { - await DAHelper.batchInsert( - "error", - valueBucketArray, - (err, data) => { - console.debug("=ACTS_BatchInsert_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_BatchInsert_1200====:' + err); - console.log('ACTS_BatchInsert_1200====: ' + DAHelper) - try { - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - - DAHelper.batchInsert( - 123456, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_1300 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_BatchInsert_1300==== { - console.debug("=ACTS_BatchInsert_1300 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_1300====:' + err); - console.log('ACTS_BatchInsert_1300====: ' + DAHelper) - var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, - { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) - try { - await DAHelper.batchInsert( - 123456, - valueBucketArray, - (err, data) => { - console.debug("=ACTS_BatchInsert_1400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - console.log('ACTS_BatchInsert_1400====:' + err); - console.log('ACTS_BatchInsert_1400====: ' + DAHelper) - try { - DAHelper.batchInsert( - dataAbilityUri, - valueBucket, - ).then((data) => { - console.debug("=ACTS_BatchInsert_1500 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_BatchInsert_1500==== { - console.debug("=ACTS_BatchInsert_1500 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_BatchInsert_1500====:' + err); - console.log('ACTS_BatchInsert_1500====: ' + DAHelper) - try { - await DAHelper.batchInsert( - dataAbilityUri, - valueBucket, - (err, data) => { - console.debug("=ACTS_BatchInsert_1600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(0); - console.log('ACTS_BatchInsert_1600====:' + err); - console.log('ACTS_BatchInsert_1600====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_0100====:' + err); - console.log('ACTS_Query_0100==== { - console.debug("=ACTS_Query_0200 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_0200====:' + err); - console.log('ACTS_Query_0200====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_0300====:' + err); - console.log('ACTS_Query_0300==== { - console.debug("=ACTS_Query_0400 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_0400====:' + err); - console.log('ACTS_Query_0400====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_0500====:' + err); - console.log('ACTS_Query_0500==== { - console.debug("=ACTS_Query_0600 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_0600====:' + err); - console.log('ACTS_Query_0600====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_0700====:' + err); - console.log('ACTS_Query_0700==== { - console.debug("=ACTS_Query_0800 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_0800====:' + err); - console.log('ACTS_Query_0800====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_0900====:' + err); - console.log('ACTS_Query_0900==== { - console.debug("=ACTS_Query_1000 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_1000====:' + err); - console.log('ACTS_Query_1000====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_1100====:' + err); - console.log('ACTS_Query_1100==== { - console.debug("=ACTS_Query_1200 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_1200====:' + err); - console.log('ACTS_Query_1200====" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); - expect(typeof (queryPromise)).assertEqual("object"); - console.log('ACTS_Query_1300====:' + err); - console.log('ACTS_Query_1300==== { - console.debug("=ACTS_Query_1400 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(data) + (" 】;") + " , " + data); - expect(typeof (data)).assertEqual("object"); - console.log('ACTS_Query_1400====:' + err); - console.log('ACTS_Query_1400====: ' + DAHelper) - try { - let valueBucketNull = {}; - let predicates = new ohosDataAbility.DataAbilityPredicates(); - console.debug("=ACTS_Update_0100 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - dataAbilityUri, - valueBucketNull, - predicates - ).then((data) => { - console.debug("=ACTS_Update_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-2); - console.log('ACTS_Update_0100==== { - console.debug("=ACTS_Update_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Update_0100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Update_0100====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - dataAbilityUri, - valueBucketNull, - predicates, - (err, data) => { - console.debug("=ACTS_Update_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-2); - console.log('ACTS_Update_0200====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Update_0200====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_0300 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - dataAbilityUri, - valueBucket, - predicates - ).then((data) => { - console.debug("=ACTS_Update_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - console.log('ACTS_Update_0300==== { - console.debug("=ACTS_Update_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Update_0300====:' + err); - console.log('ACTS_Update_0300====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_0400 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - dataAbilityUri, - valueBucket, - predicates, - (err, data) => { - console.debug("=ACTS_Update_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - console.log('ACTS_Update_0400====:' + err); - console.log('ACTS_Update_0400====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_0500 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - undefined, - valueBucket, - predicates - ).then((data) => { - console.debug("=ACTS_Update_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_Update_0500==== { - console.debug("=ACTS_Update_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Update_0500====:' + err); - console.log('ACTS_Update_0500====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_0600 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - undefined, - valueBucket, - predicates, - (err, data) => { - console.debug("=ACTS_Update_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - expect(data).assertEqual(0); - console.log('ACTS_Update_0600====:' + err); - console.log('ACTS_Update_0600====: ' + DAHelper) - var currentAlertTimeout; - try { - function onAsyncCallbackUpdate0700(err) { - expect(err.code).assertEqual(0); - clearTimeout(currentAlertTimeout); - console.log('ACTS_Update_0700====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - dataAbilityUri, - valueBucket, - predicates - ).then((data) => { - console.debug("=ACTS_Update_0700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_Update_0700==== { - console.debug("=ACTS_Update_0700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ") + err); - console.log('ACTS_Update_0700====:' + err); - console.log('ACTS_Update_0700====: ' + DAHelper) - var currentAlertTimeout; - try { - function onAsyncCallbackUpdate0800(err) { - expect(err.code).assertEqual(0); - clearTimeout(currentAlertTimeout); - console.log('ACTS_Update_0800====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - dataAbilityUri, - valueBucket, - predicates, - (err, data) => { - console.debug("=ACTS_Update_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_Update_0800====:' + err); - console.log('ACTS_Update_0800====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_0900 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - 123456, - valueBucket, - predicates - ).then((data) => { - console.debug("=ACTS_Update_0900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_Update_0900==== { - console.debug("=ACTS_Update_0900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Update_0900====:' + err); - console.log('ACTS_Update_0900====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_1000 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - 123456, - valueBucket, - predicates, - (err, data) => { - console.debug("=ACTS_Update_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - expect(data).assertEqual(0); - console.log('ACTS_Update_1000====:' + err); - console.log('ACTS_Update_1000====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_1100 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - dataAbilityUri2, - valueBucket, - predicates - ).then((data) => { - console.debug("=ACTS_Update_1100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_Update_1100==== { - console.debug("=ACTS_Update_1100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Update_1100====:' + err); - console.log('ACTS_Update_1100====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_1200 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - dataAbilityUri2, - valueBucket, - predicates, - (err, data) => { - console.debug("=ACTS_Update_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_Update_1200====:' + err); - console.log('ACTS_Update_1200====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_1300 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.update( - "error_uri", - valueBucket, - predicates - ).then((data) => { - console.debug("=ACTS_Update_1300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_Update_1300==== { - console.debug("=ACTS_Update_1300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Update_1300====:' + err); - console.log('ACTS_Update_1300====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Update_1400 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.update( - "error_uri", - valueBucket, - predicates, - (err, data) => { - console.debug("=ACTS_Update_1400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_Update_1400====:' + err); - console.log('ACTS_Update_1400====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - console.debug("=ACTS_Delete_0100 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - dataAbilityUri, - predicates - ).then((data) => { - console.debug("=ACTS_Delete_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - console.log('ACTS_Delete_0100==== { - console.debug("=ACTS_Delete_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Delete_0100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_0100====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - console.debug("=ACTS_Delete_0200 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - dataAbilityUri, - predicates, - (err, data) => { - console.debug("=ACTS_Delete_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - console.log('ACTS_Delete_0200====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_0200====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - dataAbilityUri, - predicates - ).then((data) => { - console.debug("=ACTS_Delete_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - console.log('ACTS_Delete_0300==== { - console.debug("=ACTS_Delete_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Delete_0300====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_0300====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Delete_0400 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - dataAbilityUri, - predicates, - (err, data) => { - console.debug("=ACTS_Delete_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - console.log('ACTS_Delete_0400====:' + err); - console.log('ACTS_Delete_0400====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - undefined, - predicates - ).then((data) => { - console.debug("=ACTS_Delete_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_Delete_0500==== { - console.debug("=ACTS_Delete_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Delete_0500====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_0500====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Delete_0600 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - undefined, - predicates, - (err, data) => { - console.debug("=ACTS_Delete_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - expect(data).assertEqual(0); - console.log('ACTS_Delete_0600====:' + err); - console.log('ACTS_Delete_0600====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - dataAbilityUri, - predicates - ).then((data) => { - console.debug("=ACTS_Delete_0700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(1); - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_Delete_0700==== { - console.debug("=ACTS_Delete_0700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Delete_0700====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_0700====: ' + DAHelper) - var currentAlertTimeout; - try { - function onAsyncCallbackDelete0800(err) { - expect(err.code).assertEqual(0); - clearTimeout(currentAlertTimeout); - console.log('ACTS_Delete_0800====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - dataAbilityUri, - predicates, - (err, data) => { - console.debug("=ACTS_Delete_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(1); - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_Delete_0800====:' + err); - console.log('ACTS_Delete_0800====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - dataAbilityUri2, - predicates - ).then((data) => { - console.debug("=ACTS_Delete_0900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_Delete_0900==== { - console.debug("=ACTS_Delete_0900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Delete_0900====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_0900====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Delete_1000 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - dataAbilityUri2, - predicates, - (err, data) => { - console.debug("=ACTS_Delete_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_Delete_1000====:' + err); - console.log('ACTS_Delete_1000====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - "error", - predicates - ).then((data) => { - console.debug("=ACTS_Delete_1100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1); - console.log('ACTS_Delete_1100==== { - console.debug("=ACTS_Delete_1100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Delete_1100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_1100====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Delete_1200 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - "error", - predicates, - (err, data) => { - console.debug("=ACTS_Delete_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_Delete_1200====:' + err); - console.log('ACTS_Delete_1200====" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - DAHelper.delete( - 123456, - predicates - ).then((data) => { - console.debug("=ACTS_Delete_1300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0); - console.log('ACTS_Delete_1300==== { - console.debug("=ACTS_Delete_1300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_Delete_1300====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Delete_1300====: ' + DAHelper) - try { - let predicates = new ohosDataAbility.DataAbilityPredicates(); - predicates.equalTo('contact_id', 1); - predicates.limitAs(10); - predicates.orderByAsc("order_by_class"); - predicates.offsetAs(1); - console.debug("=ACTS_Delete_1400 predicates====>" - + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); - await DAHelper.delete( - 123456, - predicates, - (err, data) => { - console.debug("=ACTS_Delete_1400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - console.log('ACTS_Delete_1400====:' + err); - console.log('ACTS_Delete_1400==== { - console.debug("=ACTS_GetFileTypes_0100 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(3); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0100 for data[' + i + '] ====>: ' + data[i]) - if (i == 0) { - expect(data[i]).assertEqual("hap"); - } else if (i == 1) { - expect(data[i]).assertEqual("jpg"); - } else if (i == 2) { - expect(data[i]).assertEqual("image/png"); - } - } - console.log('ACTS_GetFileTypes_0100==== { - console.debug("=ACTS_GetFileTypes_0100 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_0100====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_0100 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_0100====: ' + DAHelper) - let mimeTypeFilter = '*/*' - try { - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_0200 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_0200 data.length ====>: ' + data.length); - expect(data.length).assertEqual(3); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0200 for data ====>: ' + err.code + - " data[" + i + "]: " + data[i]); - if (i == 0) { - expect(data[i]).assertEqual("hap"); - } else if (i == 1) { - expect(data[i]).assertEqual("jpg"); - } else if (i == 2) { - expect(data[i]).assertEqual("image/png"); - } - } - console.log('ACTS_GetFileTypes_0200====:' + err); - console.log('ACTS_GetFileTypes_0200==== { - console.debug("=ACTS_GetFileTypes_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(1); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('= =ACTS_GetFileTypes_0300 for data[' + i + '] ====>: ' + data[i]) - if (i == 0) { - expect(data[i]).assertEqual("image/png"); - } - } - console.log('ACTS_GetFileTypes_0300==== { - console.debug("=ACTS_GetFileTypes_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('DataAbilityHelper getFileTypes error ====>: ' + err) - console.log('ACTS_GetFileTypes_0300====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_0300 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_0300====: ' + DAHelper) - let mimeTypeFilter = 'image/*' - try { - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(1); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0400 for ====>: ' - + err.code + " data[" + i + "]: " + data[i]); - if (i == 0) { - expect(data[i]).assertEqual("image/png"); - } - } - console.log('ACTS_GetFileTypes_0400====:' + err); - console.log('ACTS_GetFileTypes_0400==== { - console.debug("=ACTS_GetFileTypes_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(1); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0500 for data [' + i + '] ====>: ' + data[i]) - if (i == 0) { - expect(data[i]).assertEqual("jpg"); - } - } - console.log('ACTS_GetFileTypes_0500==== { - console.debug("=ACTS_GetFileTypes_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('DataAbilityHelper getFileTypes error ====>: ' + err) - console.log('ACTS_GetFileTypes_0500====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_0500 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_0500====: ' + DAHelper) - let mimeTypeFilter = '*/jpg' - try { - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_0600 data.length ====>: ' + data.length); - expect(data.length).assertEqual(1); - for (var i = 0; i < data.length; i++) { - console.log('=ACTS_GetFileTypes_0600 for errCode ====>: ' + err.code + - " data[" + i + "]: " + data[i]); - if (i == 0) - expect(data[i]).assertEqual("jpg"); - } - console.log('ACTS_GetFileTypes_0600====:' + err); - console.log('ACTS_GetFileTypes_0600==== { - console.debug("=ACTS_GetFileTypes_0700 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_0700==== { - console.debug("=ACTS_GetFileTypes_0700 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_0700====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_0700 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_0700====: ' + DAHelper) - let mimeTypeFilter = '*/*' - try { - await DAHelper.getFileTypes( - undefined, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_0800 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_0800 data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_0800====:' + err); - console.log('ACTS_GetFileTypes_0800==== { - console.debug("=ACTS_GetFileTypes_0900 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0900 for data[' + i + '] ====>: ' + data[i]) - if (i == 0) { - expect(data[i]).assertEqual(""); - } - } - console.log('ACTS_GetFileTypes_0900==== { - console.debug("=ACTS_GetFileTypes_0900 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_0900====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_0900 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_0900====: ' + DAHelper) - try { - await DAHelper.getFileTypes( - dataAbilityUri, - undefined, - (err, data) => { - console.debug("=ACTS_GetFileTypes_1000 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_1000 data.length ====>: ' + data.length); - for (var i = 0; i < data.length; i++) { - expect(typeof (data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_1000 for data ====>: ' + err.code + - " data[" + i + "]: " + data[i]); - if (i == 0) { - expect(data[i]).assertEqual(""); - } - } - console.log('ACTS_GetFileTypes_1000====:' + err); - console.log('ACTS_GetFileTypes_1000==== { - console.debug("=ACTS_GetFileTypes_1100 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1100==== { - console.debug("=ACTS_GetFileTypes_1100 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_1100====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_1100 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_1100====: ' + DAHelper) - let mimeTypeFilter = '*/*' - try { - await DAHelper.getFileTypes( - "error_uri", - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_1200 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_1200 data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1200====:' + err); - console.log('ACTS_GetFileTypes_1200==== { - console.debug("=ACTS_GetFileTypes_1300 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1300==== { - console.debug("=ACTS_GetFileTypes_1300 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_1300====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_1300 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_1300====: ' + DAHelper) - let mimeTypeFilter = '*/*' - try { - await DAHelper.getFileTypes( - 123456, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_1400 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_1400 data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1400====:' + err); - console.log('ACTS_GetFileTypes_1400==== { - console.debug("=ACTS_GetFileTypes_1500 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1500==== { - console.debug("=ACTS_GetFileTypes_1500 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_1500====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_1500 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_1500====: ' + DAHelper) - let mimeTypeFilter = 'asdfasdEDF)(#@*7fasdf546546a1ds3v16a4sd6v54@*(e7'; - try { - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_1600 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_1600 data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1600====:' + err); - console.log('ACTS_GetFileTypes_1600==== { - console.debug("=ACTS_GetFileTypes_1700 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1700==== { - console.debug("=ACTS_GetFileTypes_1700 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetFileTypes_1700====: ' + promise) - } catch (err) { - console.error('=ACTS_GetFileTypes_1700 getFileTypes AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetFileTypes_1700====: ' + DAHelper) - let mimeTypeFilter = 'returnUndefined'; - try { - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err, data) => { - console.debug("=ACTS_GetFileTypes_1800 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('=ACTS_GetFileTypes_1800 data.length ====>: ' + data.length); - expect(data.length).assertEqual(0); - console.log('ACTS_GetFileTypes_1800====:' + err); - console.log('ACTS_GetFileTypes_1800==== { - console.debug("=ACTS_GetType_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(dataAbilityUri); - console.log('ACTS_GetType_0100==== { - console.debug("=ACTS_GetType_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetType_0100====: ' + promise) - } catch (err) { - console.error('=ACTS_GetType_0100 getType AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetType_0100====: ' + DAHelper) - try { - await DAHelper.getType( - dataAbilityUri, - (err, data) => { - console.debug("=ACTS_GetType_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(dataAbilityUri); - console.log('ACTS_GetType_0200====:' + err); - console.log('ACTS_GetType_0200==== { - console.debug("=ACTS_GetType_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0300==== { - console.debug("=ACTS_GetType_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetType_0300====: ' + promise) - } catch (err) { - console.error('=ACTS_GetType_0300 getType AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetType_0300====: ' + DAHelper) - try { - await DAHelper.getType( - undefined, - (err, data) => { - console.debug("=ACTS_GetType_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0400====:' + err); - console.log('ACTS_GetType_0400==== { - console.debug("=ACTS_GetType_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0500==== { - console.debug("=ACTS_GetType_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetType_0500====: ' + promise) - } catch (err) { - console.error('=ACTS_GetType_0500 getType AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetType_0500====: ' + DAHelper) - try { - await DAHelper.getType( - 123456, - (err, data) => { - console.debug("=ACTS_GetType_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0600====:' + err); - console.log('ACTS_GetType_0600==== { - console.debug("=ACTS_GetType_0700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0700==== { - console.debug("=ACTS_GetType_0700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetType_0700====: ' + promise) - } catch (err) { - console.error('=ACTS_GetType_0700 getType AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetType_0700====: ' + DAHelper) - try { - await DAHelper.getType( - "error_uri", - (err, data) => { - console.debug("=ACTS_GetType_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0800====:' + err); - console.log('ACTS_GetType_0800==== { - console.debug("=ACTS_GetType_0900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_0900==== { - console.debug("=ACTS_GetType_0900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_GetType_0900====: ' + promise) - } catch (err) { - console.error('=ACTS_GetType_0900 getType AsyncCallback catch(err)====>:' + err); - console.log('ACTS_GetType_0900====: ' + DAHelper) - try { - await DAHelper.getType( - dataAbilityUri3, - (err, data) => { - console.debug("=ACTS_GetType_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_GetType_1000====:' + err); - console.log('ACTS_GetType_1000==== { - console.debug("=ACTS_OpenFile_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(typeof (data)).assertEqual("number") - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - expect(false).assertTrue(); - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_0100 getType catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0100==== { - console.debug("=ACTS_OpenFile_0200 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(typeof (data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0200 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0200 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_0200 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0200==== { - console.debug("=ACTS_OpenFile_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(typeof (data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0300 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - expect(false).assertTrue(); - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_0300 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0300==== { - console.debug("=ACTS_OpenFile_0400 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(typeof (data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0400 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0400 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - expect(false).assertTrue(); - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_0400 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0400==== { - console.debug("=ACTS_OpenFile_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(typeof (data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0500 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - expect(false).assertTrue(); - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_0500 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0500==== { - console.debug("=ACTS_OpenFile_0600 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(typeof (data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0600 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0600 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - expect(false).assertTrue(); - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_0600 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0600====: ' + DAHelper) - var mode = "r"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_0700 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0700 OpenFile asyncCallback errCode ====>: ' - + err.code + " data: " + data); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_0700 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0700====: ' + DAHelper) - var mode = "w"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0800 OpenFile asyncCallback errCode ====>: ' - + err.code + " data: " + data); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_0800 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0800====: ' + DAHelper) - var mode = "wt"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_0900 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0900 OpenFile asyncCallback errCode ====>: ' - + err.code + " data: " + data); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_0900 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_0900====: ' + DAHelper) - var mode = "wa"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_1000 err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_1000 OpenFile asyncCallback errCode ====>: ' - + err.code + " data: " + data); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_1000 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_1000====: ' + DAHelper) - var mode = "rw"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_1100 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("number"); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_1100 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_1100====: ' + DAHelper) - var mode = "rwt"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("number"); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_1200 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_1200==== { - console.debug("=ACTS_OpenFile_1300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(0) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_1300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - expect(false).assertTrue(); - done(); - }); - } catch (err) { - console.error('=ACTS_OpenFile_1300 getType catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_1300====: ' + DAHelper) - var mode = "rwt"; - try { - DAHelper.openFile( - undefined, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_1400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - ret = true - done(); - }, - ); - } catch (err) { - console.error('=ACTS_OpenFile_1400 getType AsyncCallback catch(err)====>:' + err); - ret = false - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.log('setTimeout function====<'); - }, gSetTimeout); - console.log('ACTS_OpenFile_1400==== { - console.debug("=ACTS_OpenFile_1500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1) - console.log('ACTS_OpenFile_1500==== { - console.debug("=ACTS_OpenFile_1500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_OpenFile_1500====:' + err); - console.log('ACTS_OpenFile_1500====: ' + DAHelper) - try { - DAHelper.openFile( - dataAbilityUri, - undefined, - (err, data) => { - console.debug("=ACTS_OpenFile_1600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_OpenFile_1600====:' + err); - console.log('ACTS_OpenFile_1600==== { - console.debug("=ACTS_OpenFile_1700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1) - console.log('ACTS_OpenFile_1700==== { - console.debug("=ACTS_OpenFile_1700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_OpenFile_1700====:' + err); - console.log('ACTS_OpenFile_1700====: ' + DAHelper) - var mode = "A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7"; - try { - DAHelper.openFile( - dataAbilityUri, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_1800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_OpenFile_1800====:' + err); - console.log('ACTS_OpenFile_1800==== { - console.debug("=ACTS_OpenFile_1900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(-1) - console.log('ACTS_OpenFile_1900==== { - console.debug("=ACTS_OpenFile_1900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_OpenFile_1900====:' + err); - console.log('ACTS_OpenFile_1900====: ' + DAHelper) - var mode = "rwt"; - try { - DAHelper.openFile( - dataAbilityUri2, - mode, - (err, data) => { - console.debug("=ACTS_OpenFile_2000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(-1); - console.log('ACTS_OpenFile_2000====:' + err); - console.log('ACTS_OpenFile_2000====: ' + DAHelper) - try { - DAHelper.normalizeUri( - dataAbilityUri, - ).then((data) => { - console.debug("=ACTS_NormalizeUri_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(dataAbilityUri); - console.log('ACTS_NormalizeUri_0100==== { - console.debug("=ACTS_NormalizeUri_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_NormalizeUri_0100====:' + err); - console.log('ACTS_NormalizeUri_0100====: ' + DAHelper) - try { - DAHelper.normalizeUri( - dataAbilityUri, - (err, data) => { - console.debug("=ACTS_NormalizeUri_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(typeof (data)).assertEqual("string"); - expect(data).assertEqual(dataAbilityUri); - console.log('ACTS_NormalizeUri_0200====:' + err); - console.log('ACTS_NormalizeUri_0200====: ' + DAHelper) - try { - DAHelper.normalizeUri( - undefined, - ).then((data) => { - console.debug("=ACTS_NormalizeUri_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_NormalizeUri_0300==== { - console.debug("=ACTS_NormalizeUri_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_NormalizeUri_0300====:' + err); - console.log('ACTS_NormalizeUri_0300====: ' + DAHelper) - try { - DAHelper.normalizeUri( - undefined, - (err, data) => { - console.debug("=ACTS_NormalizeUri_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - console.log('ACTS_NormalizeUri_0400====:' + err); - console.log('ACTS_NormalizeUri_0400====: ' + DAHelper) - try { - DAHelper.normalizeUri( - 123456, - ).then((data) => { - console.debug("=ACTS_NormalizeUri_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_NormalizeUri_0500==== { - console.debug("=ACTS_NormalizeUri_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_NormalizeUri_0500====:' + err); - console.log('ACTS_NormalizeUri_0500====: ' + DAHelper) - try { - DAHelper.normalizeUri( - 123456, - (err, data) => { - console.debug("=ACTS_NormalizeUri_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(err.code).assertEqual(-1); - console.log('ACTS_NormalizeUri_0600====:' + err); - console.log('ACTS_NormalizeUri_0600====: ' + DAHelper) - try { - DAHelper.normalizeUri( - "errorUri", - ).then((data) => { - console.debug("=ACTS_NormalizeUri_0700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_NormalizeUri_0700==== { - console.debug("=ACTS_NormalizeUri_0700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_NormalizeUri_0700====:' + err); - console.log('ACTS_NormalizeUri_0700====: ' + DAHelper) - try { - DAHelper.normalizeUri( - "errorUri", - (err, data) => { - console.debug("=ACTS_NormalizeUri_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_NormalizeUri_0800====:' + err); - console.log('ACTS_NormalizeUri_0800====: ' + DAHelper) - try { - DAHelper.normalizeUri( - dataAbilityUri3, - ).then((data) => { - console.debug("=ACTS_NormalizeUri_0900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_NormalizeUri_0900==== { - console.debug("=ACTS_NormalizeUri_0900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_NormalizeUri_0900====:' + err); - console.log('ACTS_NormalizeUri_0900====: ' + DAHelper) - try { - DAHelper.normalizeUri( - dataAbilityUri3, - (err, data) => { - console.debug("=ACTS_NormalizeUri_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_NormalizeUri_1000====:' + err); - console.log('ACTS_NormalizeUri_1000====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - dataAbilityUri, - ).then((data) => { - console.debug("=ACTS_DenormalizeUri_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(dataAbilityUri); - console.log('ACTS_DenormalizeUri_0100==== { - console.debug("=ACTS_DenormalizeUri_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_DenormalizeUri_0100====:' + err); - console.log('ACTS_DenormalizeUri_0100====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - dataAbilityUri, - (err, data) => { - console.debug("=ACTS_DenormalizeUri_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(dataAbilityUri); - console.log('ACTS_DenormalizeUri_0200====:' + err); - console.log('ACTS_DenormalizeUri_0200====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - undefined, - ).then((data) => { - console.debug("=ACTS_DenormalizeUri_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0300==== { - console.debug("=ACTS_DenormalizeUri_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_DenormalizeUri_0300====:' + err); - console.log('ACTS_DenormalizeUri_0300====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - undefined, - (err, data) => { - console.debug("=ACTS_DenormalizeUri_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0400====:' + err); - console.log('ACTS_DenormalizeUri_0400====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - "error", - ).then((data) => { - console.debug("=ACTS_DenormalizeUri_0500 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0500==== { - console.debug("=ACTS_DenormalizeUri_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_DenormalizeUri_0500====:' + err); - console.log('ACTS_DenormalizeUri_0500====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - "error", - (err, data) => { - console.debug("=ACTS_DenormalizeUri_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0600====:' + err); - console.log('ACTS_DenormalizeUri_0600====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - 123456, - ).then((data) => { - console.debug("=ACTS_DenormalizeUri_0700 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0700==== { - console.debug("=ACTS_DenormalizeUri_0700 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_DenormalizeUri_0700====:' + err); - console.log('ACTS_DenormalizeUri_0700====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - 123456, - (err, data) => { - console.debug("=ACTS_DenormalizeUri_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0800====:' + err); - console.log('ACTS_DenormalizeUri_0800====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - dataAbilityUri3, - ).then((data) => { - console.debug("=ACTS_DenormalizeUri_0900 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_0900==== { - console.debug("=ACTS_DenormalizeUri_0900 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('ACTS_DenormalizeUri_0900====:' + err); - console.log('ACTS_DenormalizeUri_0900====: ' + DAHelper) - try { - DAHelper.denormalizeUri( - dataAbilityUri3, - (err, data) => { - console.debug("=ACTS_DenormalizeUri_1000 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - expect(data).assertEqual(""); - console.log('ACTS_DenormalizeUri_1000====:' + err); - console.log('ACTS_DenormalizeUri_1000==== { - console.debug("=ACTS_OnOff_0100 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(err.code).assertEqual(0); - } - ); - } - } catch (err) { - console.error('=ACTS_OnOff_0100 catch(err)====>:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0100===="); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - console.log('ACTS_OnOff_0200==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_0200 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0200==== { - expect(err.code).assertEqual(0); - console.log('ACTS_OnOff_0200====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0200====" + caller); - if (flagCallback01 == 1 && flagCallback02 == 1 && flagCallback03 == 1) { - clearTimeout(currentAlertTimeout); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0301); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0302); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0303); - console.log('ACTS_OnOff_0300==== { - console.debug('ACTS_OnOff_0300====" - + flagCallback01 + flagCallback02 + flagCallback03); - } - } - try { - expect(typeof (DAHelper)).assertEqual("object"); - - DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0301); - DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0302); - DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0303); - - setTimeout(mySetTimeout, gSetTimeout); - function mySetTimeout() { - DAHelper.notifyChange( - dataAbilityUri, - (err) => { - expect(err.code).assertEqual(0); - waitDone("notifyChange"); - } - ); - } - } catch (err) { - console.error('=ACTS_OnOff_0300 catch(err)====>:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0300====" - + ("json flagCallback02【") + JSON.stringify(flagCallback02) + (" 】") + " , " + flagCallback02); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - console.log('ACTS_OnOff_0400====" + caller); - if (flagCallback01 == 1 && flagCallback02 == 0 && flagCallback03 == 1) { - clearTimeout(currentAlertTimeout); - function mySetTimeout() { - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0401); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0403); - console.log('ACTS_OnOff_0400==== { - console.debug('ACTS_OnOff_0400====" - + flagCallback01 + flagCallback02 + flagCallback03); - } - } - try { - expect(typeof (DAHelper)).assertEqual("object"); - - DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0401); - DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0402); - DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0403); - - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0402); - - setTimeout(mySetTimeout, gSetTimeout); - function mySetTimeout() { - DAHelper.notifyChange( - dataAbilityUri, - (err) => { - expect(err.code).assertEqual(0); - waitDone("notifyChange"); - } - ); - } - } catch (err) { - console.error('=ACTS_OnOff_0400 catch(err)====>:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0400====" - + ("json err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - console.log('ACTS_OnOff_0500====" - + ("json err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - console.log('ACTS_OnOff_0500====" - + ("json err") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - console.log('ACTS_OnOff_0500==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_0500 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0501); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0502); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0503); - console.log('ACTS_OnOff_0500==== { - console.debug('ACTS_OnOff_0500====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0500====" + caller); - if (flagCallback01 == 2) { - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0600); - DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0600); - console.log('ACTS_OnOff_0600====" + flagCallback01); - } - } - - setTimeout(mySetTimeout, gSetTimeout); - function mySetTimeout() { - DAHelper.notifyChange( - dataAbilityUri, - (err) => { - if (err.code != 0) { - console.debug("=ACTS_OnOff_0600 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0600); - DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0600); - console.log('ACTS_OnOff_0600==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_0600 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0600); - DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0600); - console.log('ACTS_OnOff_0600====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0600==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_0700 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0700); - DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0700); - console.log('ACTS_OnOff_0700==== { - console.debug("=ACTS_OnOff_0700 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(err.code).assertEqual(0); - done(); - } - ); - } - } - ); - } - } catch (err) { - console.error('=ACTS_OnOff_0700 catch(err)====>:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0700==== { - expect(err.code).assertEqual(0); - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_OnOff_0800====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0800==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_0900 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0900==== { - console.debug('ACTS_OnOff_0900====< else true'); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0900====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_0900==== { - currentAlertTimeout = setTimeout(() => { - expect(err.code).assertEqual(0); - console.log('ACTS_OnOff_1000====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1000===="); - expect(err.code).assertEqual(0); - clearTimeout(currentAlertTimeout); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1100); - console.log('ACTS_OnOff_1100==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_1100 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1100==== { - console.debug('ACTS_OnOff_1100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1100===="); - expect(false).assertTrue(); - clearTimeout(currentAlertTimeout); - console.log('ACTS_OnOff_1200==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_1200 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1200); - console.log('ACTS_OnOff_1200==== { - console.debug('ACTS_OnOff_1200====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1200==== { - expect(err.code).assertEqual(0); - setTimeout(() => { - console.log('ACTS_OnOff_1300====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1300===="); - expect(err.code).assertEqual(0); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1400); - console.log('ACTS_OnOff_1400==== { - console.debug("=ACTS_OnOff_1400 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - } - ); - } - } catch (err) { - console.error('=ACTS_OnOff_1400 catch(err)====>:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1400===="); - expect(false).assertTrue(); - } - DAHelper.on(undefined, dataAbilityUri, onAsyncCallback1500); - - setTimeout(mySetTimeout, gSetTimeout); - function mySetTimeout() { - DAHelper.notifyChange( - dataAbilityUri, - (err) => { - expect(err.code).assertEqual(0); - currentAlertTimeout = setTimeout(() => { - console.debug('ACTS_OnOff_1500====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1500===="); - expect(err.code).assertEqual(0); - clearTimeout(currentAlertTimeout); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1600); - console.log('ACTS_OnOff_1600==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_1600 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1600==== { - console.debug('ACTS_OnOff_1600====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1600==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_1700 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1700); - gSetTimeout = 500; - done(); - } else { - currentAlertTimeout = setTimeout(() => { - expect(err.code).assertEqual(0); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1700); - console.log('ACTS_OnOff_1700====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1700===="); - expect(err.code).assertEqual(0); - clearTimeout(currentAlertTimeout); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1800); - console.log('ACTS_OnOff_1800==== { - if (err.code != 0) { - console.debug("=ACTS_OnOff_1800 err=======>" - + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1800==== { - console.debug('ACTS_OnOff_1800====:' + err); - expect(false).assertTrue(); - console.log('ACTS_OnOff_1800==== { - console.debug("=ACTS_ExecuteBatch_Insert_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Insert_0100==== { - console.debug("=ACTS_ExecuteBatch_Insert_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0100====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0100==== { - console.debug("=ACTS_ExecuteBatch_Insert_0200 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Insert_0200==== { - console.debug("=ACTS_ExecuteBatch_Insert_0200 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0200====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0200==== { - console.debug("=ACTS_ExecuteBatch_Insert_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Insert_0300==== { - console.debug("=ACTS_ExecuteBatch_Insert_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0300====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0300==== { - console.debug("=ACTS_ExecuteBatch_Insert_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(err.code).assertEqual(0); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Insert_0400====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0400==== { - console.debug("=ACTS_ExecuteBatch_Insert_0500 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(err.code).assertEqual(0); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Insert_0500====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0500==== { - console.debug("=ACTS_ExecuteBatch_Insert_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Insert_0600====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Insert_0600==== { - console.debug("=ACTS_ExecuteBatch_Update_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) - + (" 】") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Update_0100 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Update_0100 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Update_0100==== { - console.debug("=ACTS_ExecuteBatch_Update_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0100====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0100==== { - console.debug("=ACTS_ExecuteBatch_Update_0200 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(2); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Update_0200 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Update_0200 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Update_0200==== { - console.debug("=ACTS_ExecuteBatch_Update_0200 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0200====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0200==== { - console.debug("=ACTS_ExecuteBatch_Update_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") - + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Update_0300==== { - console.debug("=ACTS_ExecuteBatch_Update_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0300====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0300==== { - console.debug("=ACTS_ExecuteBatch_Update_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") - + JSON.stringify(DataAbilityResult) + (" 】;") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Update_0400 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Update_0400 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Update_0400====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0400==== { - console.debug("=ACTS_ExecuteBatch_Update_0500 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(2); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Update_0500 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Update_0500 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Update_0500====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0500==== { - console.debug("=ACTS_ExecuteBatch_Update_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Update_0600 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Update_0600 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Update_0600====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Update_0600==== { - console.debug("=ACTS_ExecuteBatch_Assert_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Assert_0100==== { - console.debug("=ACTS_ExecuteBatch_Assert_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0100====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0100==== { - console.debug("=ACTS_ExecuteBatch_Assert_0200 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Assert_0200==== { - console.debug("=ACTS_ExecuteBatch_Assert_0200 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0200====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0200==== { - console.debug("=ACTS_ExecuteBatch_Assert_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") - + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Assert_0300 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(""); - console.debug('=ACTS_ExecuteBatch_Assert_0300 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(0); - } - console.debug('ACTS_ExecuteBatch_Assert_0300==== { - console.debug("=ACTS_ExecuteBatch_Assert_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0300====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0300==== { - console.debug("=ACTS_ExecuteBatch_Assert_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Assert_0400====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0400==== { - console.debug("=ACTS_ExecuteBatch_Assert_0500 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_Assert_0500====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0500==== { - console.debug("=ACTS_ExecuteBatch_Assert_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(1); - for (var i = 0; i < data.length; i++) { - console.debug('=ACTS_ExecuteBatch_Assert_0600 for data[' + i + '].uri ====>: ' - + data[i].uri) - expect(data[i].uri).assertEqual(""); - console.debug('=ACTS_ExecuteBatch_Assert_0600 for data[' + i + '].count ====>: ' - + data[i].count) - expect(data[i].count).assertEqual(0); - } - console.debug('ACTS_ExecuteBatch_Assert_0600====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Assert_0600==== { - console.debug("=ACTS_ExecuteBatch_Delete_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Delete_0100 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Delete_0100 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Delete_0100==== { - console.debug("=ACTS_ExecuteBatch_Delete_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0100====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0100==== { - console.debug("=ACTS_ExecuteBatch_Delete_0200 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(2); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Delete_0200 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Delete_0200 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Delete_0200==== { - console.debug("=ACTS_ExecuteBatch_Delete_0200 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0200====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0200==== { - console.debug("=ACTS_ExecuteBatch_Delete_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Delete_0300 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Delete_0300 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Delete_0300==== { - console.debug("=ACTS_ExecuteBatch_Delete_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0300====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0300==== { - console.debug("=ACTS_ExecuteBatch_Delete_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Delete_0400 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Delete_0400 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Delete_0400====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0400==== { - console.debug("=ACTS_ExecuteBatch_Delete_0500 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(2); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Delete_0500 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Delete_0500 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Delete_0500====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0500==== { - console.debug("=ACTS_ExecuteBatch_Delete_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - expect(DataAbilityResult.length).assertEqual(1); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_Delete_0600 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_Delete_0600 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_Delete_0600====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_Delete_0600==== { - console.debug("=ACTS_ExecuteBatch_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_0100 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_0100 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_0100==== { - console.debug("=ACTS_ExecuteBatch_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0100====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0100==== { - console.debug("=ACTS_ExecuteBatch_0200 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_0200 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - console.debug('=ACTS_ExecuteBatch_0200 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - expect(DataAbilityResult[i].count).assertEqual(1); - } - console.debug('ACTS_ExecuteBatch_0200====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0200==== { - console.debug("=ACTS_ExecuteBatch_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_0300 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - console.debug('=ACTS_ExecuteBatch_0300 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - if (i == 2) { - expect(DataAbilityResult[i].uri).assertEqual(""); - expect(DataAbilityResult[i].count).assertEqual(0); - } else { - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - expect(DataAbilityResult[i].count).assertEqual(1); - } - } - console.debug('ACTS_ExecuteBatch_0300==== { - console.debug("=ACTS_ExecuteBatch_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0300====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0300==== { - console.debug("=ACTS_ExecuteBatch_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) - + (" 】;") + DataAbilityResult.length); - for (var i = 0; i < DataAbilityResult.length; i++) { - console.debug('=ACTS_ExecuteBatch_0400 for data[' + i + '].uri ====>: ' - + DataAbilityResult[i].uri) - console.debug('=ACTS_ExecuteBatch_0400 for data[' + i + '].count ====>: ' - + DataAbilityResult[i].count) - if (i == 2) { - expect(DataAbilityResult[i].uri).assertEqual(""); - expect(DataAbilityResult[i].count).assertEqual(0); - } else { - expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); - expect(DataAbilityResult[i].count).assertEqual(1); - } - } - console.debug('ACTS_ExecuteBatch_0400====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0400==== { - console.debug("=ACTS_ExecuteBatch_0500 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_0500==== { - console.debug("=ACTS_ExecuteBatch_0500 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0500====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0500==== { - console.debug("=ACTS_ExecuteBatch_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_0600====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0600==== { - console.debug("=ACTS_ExecuteBatch_0700 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_0700==== { - console.debug("=ACTS_ExecuteBatch_0700 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0700====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0700==== { - console.debug("=ACTS_ExecuteBatch_0800 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_0800====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0800==== { - console.debug("=ACTS_ExecuteBatch_0900 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_0900==== { - console.debug("=ACTS_ExecuteBatch_0900 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0900====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_0900==== { - console.debug("=ACTS_ExecuteBatch_1000 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_1000====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_1000==== { - console.debug("=ACTS_ExecuteBatch_1100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_1100==== { - console.debug("=ACTS_ExecuteBatch_1100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_1100====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_1100==== { - console.debug("=ACTS_ExecuteBatch_1200 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) - + (" 】;") + data.length); - expect(data.length).assertEqual(0); - console.debug('ACTS_ExecuteBatch_1200====:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); - expect(false).assertTrue(); - console.debug('ACTS_ExecuteBatch_1200====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release().then((data) => { - console.debug("=ACTS_Release_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); - expect(data).assertEqual(true); - console.log('ACTS_Release_0100==== { - console.debug("=ACTS_Release_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Release_0100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0100====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release((err, data) => { - console.debug("=ACTS_Release_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0200 data: ' + data) - expect(data).assertEqual(true); - console.log('ACTS_Release_0200====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0200====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release().then((data) => { - console.debug("=ACTS_Release_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); - expect(data).assertEqual(true); - rDAHelper.release().then((data) => { - console.debug("=ACTS_Release_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); - expect(data).assertEqual(false); - console.log('ACTS_Release_0300==== { - console.debug("=ACTS_Release_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Release_0300==== { - console.debug("=ACTS_Release_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Release_0300====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0300====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release((err, data) => { - console.debug("=ACTS_Release_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0400 data: ' + data) - expect(data).assertEqual(true); - rDAHelper.release((err, data) => { - console.debug("=ACTS_Release_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" ,") + JSON.stringify(data) + (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0400 data: ' + data) - expect(data).assertEqual(false); - console.log('ACTS_Release_0400====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0400====/system/app/ActsSpecifiedUserActionextensionZeroTest.hap"] - }, - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm create -n 102 -t normal", - "acm switch -i 101" - ], - "teardown-command":[ - "acm delete -i 101", - "acm delete -i 102" - ] - }, - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActionextensiononeTest.hap->/system/app/ActsSpecifiedUserActionextensiononeTest.hap"] - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 100" - ] - } - ] -} - diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 2af31f94003ccd1a69174aa942c8129dfa6f5d08..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,24 +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; - globalThis.startnum = 0 - console.log("MyAbilityStage finish") - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index e2bb24f02d8d0e9b72bea2f2e7faa83c1872b01c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index 3b07276d32a22b9daa7a384c95ac5fa743ae47b7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,58 +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' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne() { - console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); - console.debug("====>close this context====>") - globalThis.ability2Context.terminateSelf(); -} - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility2 onCreate") - - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility2 onWindowStageCreate") - globalThis.ability2Context = this.context - windowStage.setUIContent(this.context, "pages/index", null) - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); - } - - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100644 index d689638e378d4661777f73507e56e61398eb057a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,207 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import rpc from '@ohos.rpc'; -import osaccount from '@ohos.account.osAccount' -globalThis.ACCOUNT_ID100; -globalThis.ACCOUNT_ID101; -globalThis.ACCOUNT_ID102; -class Stub extends rpc.RemoteObject { - constructor(des) { - super(des); - } - // process client's request - onRemoteRequest(code, data, reply, option) { - reply.writeNoException(); - reply.writeString("success"); - return true; - } -} -export default class ServiceAbility extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate'); - } - onDestory(){ - console.log('ServiceAbility onDestory'); - } - onRequest(want,startId) { - console.log('ServiceAbility onRequest'); - } - - onConnect(want) { - console.log('ServiceAbility onConnect'); - console.log('globalThis.startnum is ' + globalThis.startnum); - - switch (globalThis.startnum) { - case 1: - console.log('ServiceAbility case 1'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' - },globalThis.ACCOUNT_ID100 ,{ - windowMode: 2, - displayId: 1 - }).then(() => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0100 ====>success!") - }) - console.debug("====>case 1 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 2: - console.log('ServiceAbility case 2'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' - },globalThis.ACCOUNT_ID102 ,{ - windowMode: 2, - displayId: 1 - }).then(() => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0300 ====>success!") - }) - console.debug("====>case 2 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 3: - console.log('ServiceAbility case 3'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.MainAbility2' - },globalThis.ACCOUNT_ID101,((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0500====>fail!!!"+ JSON.stringify(err)) - console.log("====>end ACTS_StartServiceAbilityWithAccount_0500====>sunccess!"+ JSON.stringify(data)) - })) - console.debug("====>case 3 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 4: - console.log('ServiceAbility case 4'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' - },globalThis.ACCOUNT_ID102, { - windowMode: 2, - displayId: 1 - },((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0600====>fail!!!"+ JSON.stringify(err)) - console.log("====>end ACTS_StartServiceAbilityWithAccount_0600====>sunccess!"+ JSON.stringify(data)) - })) - console.debug("====>case 4 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 5: - console.log('ServiceAbility case 5'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' - },globalThis.ACCOUNT_ID100).then((data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0700====>success!"+ JSON.stringify(data)) - }) - break; - case 6: - console.log('ServiceAbility case 6'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' - },globalThis.ACCOUNT_ID102,((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0900====>fail!!!") - console.log("====>end ACTS_StartServiceAbilityWithAccount_0900====>sunccess!") - })) - console.debug("====>case 6 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 7: - console.log('ServiceAbility case 7'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' - }, globalThis.ACCOUNT_ID101,((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_1100====>fail!!!"+ JSON.stringify(err)) - console.log("====>end ACTS_StartServiceAbilityWithAccount_1100====>sunccess!"+ JSON.stringify(data)) - })) - console.debug("====>case 7 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 8: - console.log('ServiceAbility case 8'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' - }, globalThis.ACCOUNT_ID102,((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_1200====>fail!!!"+ JSON.stringify(err)) - console.log("====>end ACTS_StartServiceAbilityWithAccount_1200====>sunccess!"+ JSON.stringify(data)) - })) - console.debug("====>case 8 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 9: - console.log('ServiceAbility case 9'); - this.context.connectAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2', - action: "StartAbilityPromise" - }, globalThis.ACCOUNT_ID100) - break; - case 10: - console.log('ServiceAbility case 10'); - this.context.connectAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2', - action: "StartAbilityPromise" - },globalThis.ACCOUNT_ID102) - - console.debug("====>case 10 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - default: - console.log("====> ServiceAbility end default =====>") - break; - } - } - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100644 index 7afc8f5d8c7e9aab1af42c12724bcd108861bfb0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,57 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility2 extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility2 onCreate'); - globalThis.abilityWant = want; - } - - onDestory(){ - console.log('ServiceAbility2 onDestory'); - } - - onRequest(want,startId) { - console.log('ServiceAbility2 onRequest'); - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { - console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") - this.context.terminateSelf(); - console.log("====> terminateSelf End=====>") - }); - } - - onConnect(want) { - console.log('ServiceAbility2 onConnect'); - if (want.action == 'StartAbilityPromise') { - console.log('stub StartAbilityPromise OnConnect start '); - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { - console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") - this.context.terminateSelf(); - console.log("====> StartAbilityPromise End=====>") - }); - } - } - - onDisconnect(want) { - console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility2 onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 85c2511e8ff64181a4aa29ff445e2f506e53b159..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,49 +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.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets deleted file mode 100644 index c08226f3baf1d06de1d03f083e2c17976acbea58..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,833 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -import osaccount from '@ohos.account.osAccount' - -var ACTS_ABILITYCONTEX = { - events: ["ABILITYCONTEX_Start_CommonEvent"] -}; - -const START_ABILITY_TIMEOUT = 3000; -console.debug("====>in Ability.test====>"); - -export default function abilityTest(abilityContext) { - console.debug("====>in ACTS_InterfaceMultiUsers====>"); - describe('ACTS_StartService', function () { - beforeAll(function(done) { - var osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ - console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); - globalThis.ACCOUNT_ID100 = data1[0]; - osAccountManager.activateOsAccount(101, (err)=>{ - console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ - console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); - globalThis.ACCOUNT_ID101 = data2[0]; - osAccountManager.activateOsAccount(102, (err)=>{ - console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); - osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ - console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); - globalThis.ACCOUNT_ID102 = data3[0]; - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - done(); - }) - }) - }) - }) - },3000) - }) - }) - },3000) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0100 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : In multi-user non-concurrent mode, - * the specified user is equal to the current user and the user's task list exists (promise) - */ - it('ACTS_StartServiceAbilityWithAccount_0100', 0, async function (done) { - let Subscriber - var flag = true; - var startresult = false; - globalThis.startnum = 1; - - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0100 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0100 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(() => { - done() - }, 1000) - } - - function timeout() { - console.debug('in ACTS_StartServiceAbilityWithAccount_0100 timeout'); - if (flag == true) { - expect().assertFail(); - console.debug('ACTS_StartServiceAbilityWithAccount_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0300 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user does not have a task list (the user does not exist), call Promise - */ - it('ACTS_StartServiceAbilityWithAccount_0300', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 2; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0300 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0500 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * the specified user is not equal to the current user, - * and the user's task list exists, call AsyncCallback - */ - it('ACTS_StartServiceAbilityWithAccount_0500', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 3; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - // setTimeout(() => { - - // }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0500 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0500 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0500 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - done(); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0500start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0600 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user does not have a task list (the user does not exist), - * call AsyncCallback - */ - it('ACTS_StartServiceAbilityWithAccount_0600', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 4; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0600 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0600 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0600 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0600start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0700 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user is equal to the current user, - * and the user's task list exists, call Promise - */ - it('ACTS_StartServiceAbilityWithAccount_0700', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 5; - - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0700start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(() => { - done() - }, 1000) - } - - function timeout() { - console.debug('in ACTS_StartServiceAbilityWithAccount_0700 timeout'); - if (flag == true) { - expect().assertFail(); - console.debug('ACTS_StartServiceAbilityWithAccount_0700 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0900 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user does not have a task list (the user does not exist), - * call Promise - */ - it('ACTS_StartServiceAbilityWithAccount_0900', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 6; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0900 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0900 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0900 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0900start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_1100 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * the specified user is not equal to the current user, - * and the user's task list exists, call AsyncCallback - */ - it('ACTS_StartServiceAbilityWithAccount_1100', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 7; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_1100 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_1100 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_1100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>1100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_1200 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user does not have a task list (the user does not exist), - * call AsyncCallback - */ - it('ACTS_StartServiceAbilityWithAccount_1200', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 8; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_1200 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_1200 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_1200 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>1200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0100 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user is equal to the current user and the user's task list exists - */ - it('ACTS_ConnectServiceAbilityWithAccount_0100', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 9; - - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0100 ConnectServiceAbility connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(() => { - done() - }, 1000) - } - - function timeout() { - console.debug('in ACTS_ConnectServiceAbilityWithAccount_0100 timeout'); - if (flag == true) { - expect().assertFail(); - console.debug('ACTS_ConnectServiceAbilityWithAccount_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0300 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user does not have a task list (the user does not exist) - */ - it('ACTS_ConnectServiceAbilityWithAccount_0300', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 10; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_ConnectServiceAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_ConnectServiceAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_ConnectServiceAbilityWithAccount_0300 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0300 ConnectServiceAbility connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - }) -} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index 2ff5edb425dba3b891b8c9be8ecdd720380e6792..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets +++ /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 abilityTest from './Ability.test.ets' - - -export default function testsuite(context) { - - console.debug("====>in list.test====>"); - abilityTest(context) - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json deleted file mode 100644 index 9c126792232352538eccbf0e50ad039ffee63058..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsspecifieduseractionextensionzerotest.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" - ] - } - ] - }, - { - "name": "com.example.actsspecifieduseractionextensionzerotest.MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.actsspecifieduseractionextensionzerotest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - }, - { - "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json deleted file mode 100644 index ed83806652cf16428f867cec533b239e9b78b05c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsspecifieduseractionextensiononetest", - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json deleted file mode 100644 index 69c870be2c8ae8de4cde76c5c86767d4dc201cf4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.example.actsspecifieduseractionextensiononetest", - "shell-timeout": "300000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm create -n 102 -t normal", - "acm switch -i 101" - ], - "teardown-command":[ - "acm delete -i 101", - "acm delete -i 102" - ] - }, - { - "test-file-name": [ - "ActsSpecifiedUserActionextensiononeTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - }, - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActionextensiononeTest.hap->/system/app/ActsSpecifiedUserActionextensiononeTest.hap" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 100" - ] - }, - - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActionextensionZeroTest.hap->/system/app/ActsSpecifiedUserActionextensionZeroTest.hap" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 101" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 644 /data/*.hap" - ] - } - ] -} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 77b702155893ee17996bb4cd08a54c708c6776c5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,24 +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 AbilityStage from "@ohos.application.AbilityStage" - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("MyAbilityStage onCreate") - globalThis.stageContext = this.context; - globalThis.startnum = 0 - console.log("MyAbilityStage finish") - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index a9110ed3e98f20b7fcf704bf671c9403c7ca101e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index 00ee54cb7f5d3761c063a6ef4d9c91929148efa3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,58 +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 Ability from '@ohos.application.Ability' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne() { - console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); - console.debug("====>close this context====>") - globalThis.ability2Context.terminateSelf(); -} - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility2 onCreate") - - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility2 onWindowStageCreate") - globalThis.ability2Context = this.context - windowStage.setUIContent(this.context, "pages/index", null) - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); - } - - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100644 index cdb745d7cf1c5a1da64b5c08f8c3698298923a38..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,125 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import rpc from '@ohos.rpc'; -class Stub extends rpc.RemoteObject { - constructor(des) { - super(des); - } - // process client's request - onRemoteRequest(code, data, reply, option) { - reply.writeNoException(); - reply.writeString("success"); - return true; - } -} -export default class ServiceAbility extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate'); - } - onDestory(){ - console.log('ServiceAbility onDestory'); - } - onRequest(want,startId) { - console.log('ServiceAbility onRequest'); - } - - onConnect(want) { - console.log('ServiceAbility onConnect'); - console.log('globalThis.startnum is ' + globalThis.startnum); - - switch (globalThis.startnum) { - case 1: - console.log('ServiceAbility case 1'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' - },100, { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0200 ====>success!") - }) - console.debug("====>case 1 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - break; - - case 2: - console.log('ServiceAbility case 2'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' - }, globalThis.ACCOUNT_ID100).then((data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0800====>success!"+ JSON.stringify(data)) - }) - console.debug("====>case 3 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - - case 3: - console.log('ServiceAbility case 3'); - this.context.connectAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensionzerotest', - abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' - }, globalThis.ACCOUNT_ID100) - console.debug("====>case 5 end====>"); - var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); - console.log('ThirdAbility onConnect before return:') - return myStub; - break; - case 4: - console.log('ServiceAbility case 4'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' - },101,((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_1000====>fail!!!"+ JSON.stringify(err)) - console.log("====>end ACTS_StartServiceAbilityWithAccount_1000====>sunccess!"+ JSON.stringify(data)) - })) - break; - case 5: - console.log('ServiceAbility case 5'); - this.context.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' - }, globalThis.ACCOUNT_ID101,((err, data) => { - console.log("====>end ACTS_StartServiceAbilityWithAccount_0400====>fail!!!"+ JSON.stringify(err)) - console.log("====>end ACTS_StartServiceAbilityWithAccount_0400====>sunccess!"+ JSON.stringify(data)) - })) - break; - default: - console.log("====> ServiceAbility end default =====>") - break; - } - } - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100644 index e507495a1fc05d92c4de0b1c27e03b4de5be92b4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,49 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility2 extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility2 onCreate'); - globalThis.abilityWant = want; - } - - onDestory(){ - console.log('ServiceAbility2 onDestory'); - } - - onRequest(want,startId) { - console.log('ServiceAbility2 onRequest'); - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { - console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") - this.context.terminateSelf(); - console.log("====> terminateSelf End=====>") - }); - } - - onConnect(want) { - console.log('ServiceAbility2 onConnect'); - } - - onDisconnect(want) { - console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility2 onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index c7af41137cd69406214fbe1b42f3261fea4c4aa8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,49 +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 file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets deleted file mode 100644 index 519c6280a7bd99138a93b91ffe7c22eacc613160..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,458 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -import osaccount from '@ohos.account.osAccount' - - -var ACTS_ABILITYCONTEX = { - events: ["ABILITYCONTEX_Start_CommonEvent"] -}; - -const START_ABILITY_TIMEOUT = 3000; -console.debug("====>in Ability.test====>"); - -export default function abilityTest(abilityContext) { - console.debug("====>in ACTS_InterfaceMultiUsers====>"); - describe('ACTS_StartService', function () { - beforeAll(function(done) { - var osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ - console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); - globalThis.ACCOUNT_ID100 = data1[0]; - osAccountManager.activateOsAccount(101, (err)=>{ - console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ - console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); - globalThis.ACCOUNT_ID101 = data2[0]; - osAccountManager.activateOsAccount(102, (err)=>{ - console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); - osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ - console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); - globalThis.ACCOUNT_ID102 = data3[0]; - osAccountManager.activateOsAccount(101, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - done(); - }) - }) - }) - }) - },3000) - }) - }) - },3000) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0200 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * the specified user is not equal to the current user, - * and the user's task list exists, call Promise - */ - it('ACTS_StartServiceAbilityWithAccount_0200', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 1; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0200 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0800 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * the specified user is not equal to the current user, - * and the user's task list exists, call Promise - */ - it('ACTS_StartServiceAbilityWithAccount_0800', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 2; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - done(); - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0800 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0800 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0800 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0800start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0200 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * the specified user is not equal to the current user, - * and the user's task list exists - */ - it('ACTS_ConnectServiceAbilityWithAccount_0200', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 3; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect().assertFail(); - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>ACTS_ConnectServiceAbilityWithAccount_0200 disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>ACTS_ConnectServiceAbilityWithAccount_0200 in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_ConnectServiceAbilityWithAccount_0200 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_1000 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user is equal to the current user, - * and the user's task list exists, call AsyncCallback - */ - it('ACTS_StartServiceAbilityWithAccount_1000', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 4; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_1000 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_1000 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_1000 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>1000start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_StartServiceAbilityWithAccount_0400 - * @tc.name : In multi-user non-concurrent mode - * @tc.desc : System application, in multi-user non-concurrent mode, - * when the specified user is equal to the current user, - * and the user's task list exists, call AsyncCallback - */ - it('ACTS_StartServiceAbilityWithAccount_0400', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 5; - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - - function SubscribeCallBack(err, data) { - expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); - console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ABILITYCONTEX_Start_CommonEvent") { - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - abilityContext.disconnectAbility(globalThis.number).then((err) => { - console.debug("====>err is====>" + JSON.stringify(err)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(() => { - done(); - }, 1000) - } - - function onConnectCallback(element, remote) { - console.log('ACTS_StartServiceAbilityWithAccount_0400 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_StartServiceAbilityWithAccount_0400 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_StartServiceAbilityWithAccount_0400 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.example.actsspecifieduseractionextensiononetest', - abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' - }, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index ecefaf77b73ec4f9ff4bae9da238eb9431fc172b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,23 +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 abilityTest from './Ability.test.ets' - - -export default function testsuite(context) { - - console.debug("====>in list.test====>"); - abilityTest(context) - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json deleted file mode 100644 index 56ba946b3e9f382f6bf858c7bc3ccbf100a26cb9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsspecifieduseractionextensiononetest.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" - ] - } - ] - }, - { - "name": "com.example.actsspecifieduseractionextensiononetest.MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.actsspecifieduseractionextensiononetest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - }, - { - "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.actsspecifieduseractionextensiononetest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json deleted file mode 100644 index ed5b06c79254f2185f17329ee977b447f3b33dad..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsspecifieduseractionzerotest", - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/Test.json deleted file mode 100644 index dd33d382f46e45855127780caf9573afd5dc9893..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/Test.json +++ /dev/null @@ -1,50 +0,0 @@ - -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.example.actsspecifieduseractionzerotest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsSpecifiedUserActionZeroTest.hap", - "ActsSpecifiedUserActiononeTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActionZeroTest.hap->/system/app/ActsSpecifiedUserActionZeroTest.hap"] - }, - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm create -n 102 -t normal", - "acm switch -i 101" - ] - }, - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActiononeTest.hap->/system/app/ActsSpecifiedUserActiononeTest.hap"] - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 100" - ], - "teardown-command":[ - "acm delete -i 101", - "acm delete -i 102" - ] - } - -] -} - diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index f85fcf92b35787bd01eb2edb753cdd6b49f1dfdd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index dda3b5af41be69b50e122118c9b4979f28a962f8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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; - } - - 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") - globalThis.abilityContext = this.context - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index 0f7d3fef47921704b679303d75a1447dbf59e62c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,57 +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' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne() { - console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); - console.debug("====>close this context====>") - globalThis.ability2Context.terminateSelf(); -} -export default class MainAbility2 extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility2 onCreate") - - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility2 onWindowStageCreate") - globalThis.ability2Context = this.context - windowStage.setUIContent(this.context, "pages/index", null) - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); - } - - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 85c2511e8ff64181a4aa29ff445e2f506e53b159..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,49 +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.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index 3aa7c14456fb97e151b01733fb093df5d09ec3be..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,22 +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 abilityTest from './abilityTest.ets' - - -export default function testsuite(context) { - - abilityTest(context) - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets deleted file mode 100644 index caea5b06e08c276e545e47c776bc396296eebadc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets +++ /dev/null @@ -1,935 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent'; -import osaccount from '@ohos.account.osAccount' - -var ACTS_ABILITYCONTEX = { - events: ["ABILITYCONTEX_Start_CommonEvent"] -}; -var ACCOUNT_ID100; -var ACCOUNT_ID101; -var ACCOUNT_ID102; - -const START_ABILITY_TIMEOUT = 3000; -export default function abilityTest(abilityContext) { - describe('ACTS_AbilityContext', function () { - beforeAll(function(done) { - var osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ - console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); - ACCOUNT_ID100 = data1[0]; - osAccountManager.activateOsAccount(101, (err)=>{ - console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ - console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); - ACCOUNT_ID101 = data2[0]; - osAccountManager.activateOsAccount(102, (err)=>{ - console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); - osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ - console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); - ACCOUNT_ID102 = data3[0]; - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - done(); - }) - }) - }) - }) - },3000) - }) - }) - },3000) - }) - }) - - - /* - * @tc.number: ACTS_StartStandardAbilityWithAccount_0100 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, - * call the AbilityContext::startAbilityWithAccount interface of - * Promise (with the StartOptions parameter) to start Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0100', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0100====>start") - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0100====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>ACTS_StartStandardAbilityWithAccount_0100 UnSubscribeCallback====>"); - setTimeout(function(){ - done(); - },2000) - } - - function timeout() { - if(flag == false) { - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityWithAccount_0100 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID100, - { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0100====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0300 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), - * call the AbilityContext::startAbilityWithAccount interface of - * Promise (with the StartOptions parameter) to start Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0300', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0300 ====> start") - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_0300 ====> timeout'); - done(); - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility12' - },ACCOUNT_ID102, - { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0300====>success!"+ JSON.stringify(data)) - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0500 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the AbilityContext::startAbilityWithAccount interface - * of AsyncCallback (with the StartOptions parameter) to start Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0500', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0500 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0500====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_0500 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - },ACCOUNT_ID101, { - windowMode: 2, - displayId: 1 - }, ((err, data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0500====>success!!!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0600 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), call the - * AbilityContext::startAbilityWithAccount interface of - * AsyncCallback (with the StartOptions parameter) to start the Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0600', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0600 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0600====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_0600 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID102, { - windowMode: 2, - displayId: 1 - }, ((err, data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0600====>success!!!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0700 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the - * AbilityCont. - * ext::startAbilityWithAccount interface of Promise (without the StartOptions parameter) - * to start Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0700', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0700 ====> start") - - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0700====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>ACTS_StartStandardAbilityWithAccount_0700 UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false) { - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityWithAccount_0700 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID100).then((data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0700====>success!"+ JSON.stringify(data)) - }) - }) - - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0900 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), call - * the AbilityContext::startAbilityWithAccount interface of - * Promise (without the StartOptions parameter) to start the Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0900', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0900 ====> start") - - var Subscriber; - - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0900====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_0900 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID102).then((data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0900====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_1100 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the - * AbilityContext::startAbilityWithAccount interface of - * AsyncCallback (without the StartOptions parameter) to start the Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_1100', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_1100 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_1100====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_1100 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - },ACCOUNT_ID101, ((err, data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_1100====>success!!!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_1200 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), call the - * AbilityContext::startAbilityWithAccount interface of - * AsyncCallback (without the StartOptions parameter) to start the Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_1200', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_1200 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_1200====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_1200 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID102,((err, data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_1200====>success!!!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0100 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, - * call the Promise's AbilityContext::startAbilityForResultWithAccount - * (with the StartOptions parameter) interface to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0100', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0100 ====> start") - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0100====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>ACTS_StartStandardAbilityForResultWithAccount_0100 UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false){ - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0100 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - }, ACCOUNT_ID100, - { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0100====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0300 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), - * call the AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) - * interface of Promise to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0300', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0300 ====> start") - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0300 ====> timeout'); - done(); - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID102, - { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0300====>success!"+ JSON.stringify(data)) - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0500 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the - * AsyncCallback's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) - * interface to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0500', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0500 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0500====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0500 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - }, ACCOUNT_ID101, - { - windowMode: 2, - displayId: 1 - }, ((err, data) => { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0500 === success!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0600 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), call the - * AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) interface of - * AsyncCallback to start the Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0600', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0600 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0600====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0600 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - }, ACCOUNT_ID102, - { - windowMode: 2, - displayId: 1 - }, ((err, data) => { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0600 === success!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0700 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, - * call the Promise's AbilityContext::startAbilityForResultWithAccount - * (without the StartOptions parameter) interface to start the Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0700', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0700 ====> start") - - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0700====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false) - { - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0700 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - }, ACCOUNT_ID100).then((data) => { - console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0700====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0900 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), call the - * AbilityContext::startAbilityForResultWithAccount (no StartOptions parameter) interface of - * Promise to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0900', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0900 ====> start") - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0900 ====> timeout'); - done(); - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID102).then((data) => { - console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0900====>success!"+ JSON.stringify(data)) - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1100 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the AsyncCallback's - * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) interface - * to start the Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_1100', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_1100 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_1100====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_1100 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - }, ACCOUNT_ID101, ((err, data) => { - console.log("ACTS_StartStandardAbilityForResultWithAccount_1100 === success!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1200 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), - * call the AbilityContext::startAbilityForResultWithAccount (no StartOptions parameter) - * interface of AsyncCallback to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_1200', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_1200 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_1200====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - }, ACCOUNT_ID102, ((err, data) => { - console.log("ACTS_StartStandardAbilityForResultWithAccount_1200 === success!" + JSON.stringify(data)) - })) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_1200 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /** - * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0100 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is equal to the current user and the user's task list exists, - * call the AbilityContext::connectAbilityWithAccount interface to connect to Ability. - */ - it('ACTS_ConnectStandardAbilityWithAccount_0100', 0, async function (done) { - console.log("ACTS_ConnectStandardAbilityWithAccount_0100====>start") - var Subscriber; - var flag = true; - var number = 0; - - function onConnectCallback(element, remote) { - console.log('ACTS_ConnectStandardAbilityWithAccount_0100 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_ConnectStandardAbilityWithAccount_0100 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ConnectStandardAbilityWithAccount_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>WithAccount 0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - abilityContext.disconnectAbility(number).then((err)=>{ - console.debug("====>err is====>" + JSON.stringify(err)); - }) - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_ConnectStandardAbilityWithAccount_0100====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>ACTS_ConnectStandardAbilityWithAccount_0100 UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false) { - expect().assertFail(); - console.debug('ACTS_ConnectStandardAbilityWithAccount_0100 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start connectAbilityWithAccount====>"); - number = await abilityContext.connectAbilityWithAccount({ - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', - action: "StartAbilityPromise" - }, ACCOUNT_ID100,{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - }) - - /** - * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0300 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user does not have a task list (the user does not exist), - * call the AbilityContext::connectAbilityWithAccount interface to connect the Ability. - */ - it('ACTS_ConnectStandardAbilityWithAccount_0300', 0, async function (done) { - console.log("ACTS_ConnectStandardAbilityWithAccount_0300 ====> start") - var Subscriber; - var flag = true; - var number = 0; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>WithAccount 0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - abilityContext.disconnectAbility(number).then((err)=>{ - console.debug("====>err is====>" + JSON.stringify(err)); - }) - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function onConnectCallback(element, remote) { - console.log('ACTS_ConnectStandardAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_ConnectStandardAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_ConnectStandardAbilityWithAccount_0300====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start connectAbilityWithAccount====>"); - number = await abilityContext.connectAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', - action: "StartAbilityPromise" - },ACCOUNT_ID102 ,{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json deleted file mode 100644 index d6278a9b4360ea4445bcec8dbac16a5234330935..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsspecifieduseractionzerotest.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" - ] - } - ] - }, - { - "name": "com.example.actsspecifieduseractionzerotest.MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.actsspecifieduseractionzerotest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json deleted file mode 100644 index c828e9ea13ce4521ee8fee589fa097bd2562cd28..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsspecifieduseractiononetest", - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/Test.json deleted file mode 100644 index 5f76cadc76d94d80dcfd69f5ed322130eadbc98c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/Test.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.example.actsspecifieduseractiononetest", - "shell-timeout": "300000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm create -n 102 -t normal", - "acm switch -i 101" - ] - }, - { - "test-file-name": [ - "ActsSpecifiedUserActiononeTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - }, - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActiononeTest.hap->/system/app/ActsSpecifiedUserActiononeTest.hap" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 100" - ] - }, - - { - "type": "PushKit", - "push": [ - "ActsSpecifiedUserActionZeroTest.hap->/system/app/ActsSpecifiedUserActionZeroTest.hap" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 101" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 644 /data/*.hap" - ] - } - ] -} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index b1c5ee1bb927e65a011b199387cf07e6611773b8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index dda3b5af41be69b50e122118c9b4979f28a962f8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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; - } - - 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") - globalThis.abilityContext = this.context - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index 1cc88f96131c8b2448d384b5b27ce77832a34bc7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,57 +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' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne() { - console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); - console.debug("====>close this context====>") - globalThis.ability2Context.terminateSelf(); -} - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility2 onCreate") - - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility2 onWindowStageCreate") - globalThis.ability2Context = this.context - commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); - } - - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 85c2511e8ff64181a4aa29ff445e2f506e53b159..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,49 +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.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index 53cc0398619d5d572e4dc1ed0cff44f75c2aa040..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,22 +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 abilityTest from './abilityTest.ets' - - -export default function testsuite(context) { - - abilityTest(context) - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets deleted file mode 100644 index 506fdcc1cfdbcef20efffd3ee98dcd63ddde7e5d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets +++ /dev/null @@ -1,540 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent'; -import osaccount from '@ohos.account.osAccount' - -var ACTS_ABILITYCONTEX = { - events: ["ABILITYCONTEX_Start_CommonEvent"] -}; -var ACCOUNT_ID100; -var ACCOUNT_ID101; -var ACCOUNT_ID102; - -const START_ABILITY_TIMEOUT = 3000; -export default function abilityTest(abilityContext) { - describe('ACTS_AbilityContext', function () { - beforeAll(function(done) { - var osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ - console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); - ACCOUNT_ID100 = data1[0]; - osAccountManager.activateOsAccount(101, (err)=>{ - console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); - setTimeout(()=>{ - osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ - console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); - ACCOUNT_ID101 = data2[0]; - osAccountManager.activateOsAccount(102, (err)=>{ - console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); - osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ - console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); - console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); - ACCOUNT_ID102 = data3[0]; - osAccountManager.activateOsAccount(101, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - done(); - }) - }) - }) - }) - },3000) - }) - }) - },3000) - }) - }) - - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0200 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the Promise's AbilityContext::startAbilityWithAccount - * interface (with the StartOptions parameter) to start Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0200', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0200====>start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0200====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_0200 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID100, - { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0200====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0400 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, - * call the AbilityContext::startAbilityWithAccount interface of - * AsyncCallback (with the StartOptions parameter) to start Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0400', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0400 ====> start") - - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0400====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false){ - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityWithAccount_0400 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - },ACCOUNT_ID101, - { - windowMode: 2, - displayId: 1 - }, ((err, data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0400====>success!!!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_0800 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the Promise's AbilityContext::startAbilityWithAccount - * interface (without the StartOptions parameter) to start the Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_0800', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_0800 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_0800====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityWithAccount_0800 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - },ACCOUNT_ID100).then((data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_0800====>success!"+ JSON.stringify(data)) - }) - }) - - - /** - * @tc.number: ACTS_StartStandardAbilityWithAccount_1000 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the - * AbilityContext::startAbilityWithAccount interface of - * AsyncCallback (without the StartOptions parameter) to start the Ability. - */ - it('ACTS_StartStandardAbilityWithAccount_1000', 0, async function (done) { - console.log("ACTS_StartStandardAbilityWithAccount_1000 ====> start") - - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityWithAccount_1000====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false){ - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityWithAccount_1000 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbility====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - },ACCOUNT_ID101, ((err, data) => { - console.log("====>end ACTS_StartStandardAbilityWithAccount_1000====>success!!!" + JSON.stringify(data)) - })) - }) - - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0200 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the - * Promise's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) - * interface to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0200', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0200 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0200====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0200 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - }, ACCOUNT_ID100, - { - windowMode: 2, - displayId: 1 - }).then((data) => { - console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0200====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0400 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the - * AsyncCallback's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) - * interface to start the Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0400', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0400 ====> start") - - var Subscriber; - var flag = false; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0400====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false){ - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0400 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - }, ACCOUNT_ID101, - { - windowMode: 2, - displayId: 1 - }, ((err, data) => { - console.log("StartStandardAbilityForResultWithAccount_0400 === success!" + JSON.stringify(data)) - })) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0800 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the Promise's - * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) interface - * to start Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_0800', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_0800 ====> start") - - var Subscriber; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_0800====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_StartStandardAbilityForResultWithAccount_0800 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' - }, ACCOUNT_ID100).then((data) => { - console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0800====>success!"+ JSON.stringify(data)) - }) - }) - - /** - * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1000 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the AsyncCallback's - * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) - * interface to start the Ability. - */ - it('ACTS_StartStandardAbilityForResultWithAccount_1000', 0, async function (done) { - console.log("ACTS_StartStandardAbilityForResultWithAccount_1000 ====> start") - var flag = false; - var Subscriber; - - function SubscribeCallBack(err, data) { - flag = true; - expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); - console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_StartStandardAbilityForResultWithAccount_1000====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - if(flag == false){ - expect().assertFail(); - console.debug('ACTS_StartStandardAbilityForResultWithAccount_1000 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - - } - } - - - setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResultWithAccount( - { - bundleName: 'com.example.actsspecifieduseractiononetest', - abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' - }, ACCOUNT_ID101, ((err, data) => { - console.log("ACTS_StartStandardAbilityForResultWithAccount_1000 === success!" + JSON.stringify(data)) - })) - }) - - - /** - * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0200 - * @tc.name: Provides a system interface to specify user startup components (standard page). - * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, - * call the AbilityContext::connectAbilityWithAccount interface to connect the Ability. - */ - it('ACTS_ConnectStandardAbilityWithAccount_0200', 0, async function (done) { - console.log("ACTS_ConnectStandardAbilityWithAccount_0200 ====> start") - var Subscriber; - var flag = true; - var number = 0; - - function SubscribeCallBack(err, data) { - expect().assertFail(); - console.debug("====>WithAccount 0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - abilityContext.disconnectAbility(number).then((err)=>{ - console.debug("====>err is====>" + JSON.stringify(err)); - }) - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function onConnectCallback(element, remote) { - console.log('ACTS_ConnectStandardAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_ConnectStandardAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - - commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { - console.debug("ACTS_ConnectStandardAbilityWithAccount_0200====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start connectAbilityWithAccount====>"); - number = await abilityContext.connectAbilityWithAccount( - { - bundleName: 'com.example.actsspecifieduseractionzerotest', - abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', - action: "StartAbilityPromise" - },ACCOUNT_ID102 ,{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - done(); - } - - function timeout() { - console.debug('ACTS_ConnectStandardAbilityWithAccount_0200 ====> timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json deleted file mode 100644 index 9fb5911c1b183e7c33828ef0087b619cbfda5ebd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsspecifieduseractiononetest.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" - ] - } - ] - }, - { - "name": "com.example.actsspecifieduseractiononetest.MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.actsspecifieduseractiononetest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/Test.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/AbilityStage.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/AbilityStage.ts deleted file mode 100755 index 271d9164eb87e27cc9d6cc4515e702471d8889dd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/AbilityStage.ts +++ /dev/null @@ -1,21 +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.AbilitySatage" - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("MyAbilityStage onCreate"); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 5f8551ea9c615a693294aa3fc84136a333c3b859..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,44 +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) { - console.log("jws onCreate"); - } - - onDestroy() { - console.log("jws onDestroy"); - } - - onWindowStageCreate(windowStage) { - console.log("jws onWindowStageCreate"); - } - - onWindowStageDestroy() { - console.log("jws onWindowStageDestroy"); - } - - onForeground() { - console.log("jws onForeground"); - } - - onBackground() { - console.log("jws onBackground"); - } - - call(){ - - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100755 index 6b4120bd91a94160e64b02ba8b7b89b413c39389..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,38 +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 {Core} from 'deccjsunit/index' - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 745bfaffc123f48189566fbfcbfe4e68bb6edb84..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "ServiceExtAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - }, - { - "name": "description_dataability", - "value": "hap sample empty provider" - }, - { - "name": "description_mainability2", - "value": "eTS_Empty Ability" - }, - { - "name": "entry_MainAbility2", - "value": "entry_MainAbility2" - }, - { - "name": "description_testdataability", - "value": "hap sample empty provider" - }, - { - "name": "permreason_dataability", - "value": "request dataability premission" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/app.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/app.json deleted file mode 100755 index 2547e5749a32ffaaec6d8474fd13bbc53771d465..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.acts.actsinterfacemultiusersextensiontest", - "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100755 index 91603f6023ffa7b54f31e65c5206d61ff9a8e55b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /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 Ability from '@ohos.application.Ability' -import commonEvent from "@ohos.commonEvent" - -export default class MainAbility2 extends Ability { - - onCreate(want, launchParam) { - console.log("MainAbility2 onCreate"); - globalThis.abilityContext = this.context - } - - onDestroy() { - console.log("MainAbility2 onDestroy"); - } - - onWindowStageCreate(windowStage) { - console.log("MainAbility2 onWindowStageCreate"); - windowStage.setUIContent(this.context, "pages/index/second", null); - commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => { - console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - globalThis.abilityContext.terminateSelf().then(() => { - commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ - console.log('terminateSelf promise'); - }); - }); - }) - } - - onWindowStageDestroy() { - console.log("MainAbility2 onWindowStageDestroy"); - } - - onForeground() { - console.log("MainAbility2 onForeground"); - } - - onBackground() { - console.log("MainAbility2 onBackground"); - } -}; diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100755 index f66332f21bc4cccda5eb5bd8a4652e4a03062c09..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,51 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility2 extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility2 onCreate'); - } - - onDestory(){ - console.log('ServiceAbility2 onDestory'); - } - - onRequest(want,startId) { - console.log('ServiceAbility2 onRequest'); - commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => { - console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - this.context.terminateSelf().then(() => { - commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ - console.log('terminateSelf promise'); - }); - }); - }) - } - - onConnect(want) { - console.log('ServiceAbility2 onConnect'); - } - - onDisconnect(want) { - console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility2 onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 8b2238543638218c823f2414c955176da3af7818..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,50 +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 file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - globalThis.abilityWant.parameters['timeout'] = 10000 - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - 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/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100755 index 1f1cc68986b271833505f7d4f074ae171f7b07df..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,974 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -import osaccount from '@ohos.account.osAccount' - -var subscriberInfo_MainAbility = { - events: ["ACTS_InterfaceMultiUsersExtension_CommonEvent"] - }; -var subscriberInfo_MainAbility2 = { - events: ["ACTS_TerminateSelf_CommonEvent"] -}; -var subscriberInfo_MainAbility3 = { - events: ["ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"] -}; -var osAccountManager -const START_ABILITY_TIMEOUT = 6000; -globalThis.number = 0; -console.debug("====>in Ability.test====>"); -export default function abilityTest(abilityContext) { - console.debug("====>in function abilityTest====>"); - describe('ActsInterfaceMultiUsersExtensionTest', function () { - afterAll(function() { - osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - osAccountManager.removeOsAccount(101, (err)=>{ - console.debug("====>remove localId: 101" + " err:" + JSON.stringify(err)); - }) - }) - }) - console.debug("====>in ACTS_InterfaceMultiUsers====>"); - /* - * @tc.number : ACTS_ExtensionStartAbility_0100 - * @tc.name : start new ability - * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) - */ - it('ACTS_ExtensionStartAbility_0100', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 1 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionStartAbility_0100 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionStartAbility_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0200 - * @tc.name : start new ability - * @tc.desc : Start an ability with the parameter startability with options failed.(promise) - */ - it('ACTS_ExtensionStartAbility_0200', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 2 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect().assertFail(); - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(()=>{ - done(); - },1000) - } - function onConnectCallback(element, remote) { - console.log(' onConnectCallback====> element=' + JSON.stringify(element)); - console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ExtensionStartAbility_0200 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0300 - * @tc.name : start new ability - * @tc.desc : Start an ability with the parameter startability with options succeeded.(callback) - */ - it('ACTS_ExtensionStartAbility_0300', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum=3 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionStartAbility_0300 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionStartAbility_0300 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0400 - * @tc.name : start new ability - * @tc.desc : Start an ability with the parameter startability with options failed.(callback) - */ - it('ACTS_ExtensionStartAbility_0400', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 4 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect().assertFail(); - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(()=>{ - done(); - },1000) - } - function onConnectCallback(element, remote) { - console.log(' onConnectCallback====> element=' + JSON.stringify(element)); - console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ExtensionStartAbility_0400 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0500 - * @tc.name : start new ability - * @tc.desc : Starting mainability2 with startability succeeded.(promise) - */ - it('ACTS_ExtensionStartAbility_0500', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 5 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0500start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionStartAbility_0500 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionStartAbility_0500 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0600 - * @tc.name : start new ability - * @tc.desc : Starting mainability2 with startability failed.(promise) - */ - it('ACTS_ExtensionStartAbility_0600', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 6 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect().assertFail(); - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(()=>{ - done(); - },1000) - } - function onConnectCallback(element, remote) { - console.log(' onConnectCallback====> element=' + JSON.stringify(element)); - console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ExtensionStartAbility_0600 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0600start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0700 - * @tc.name : start new ability - * @tc.desc : Starting mainability2 with startability succeeded.(callback) - */ - it('ACTS_ExtensionStartAbility_0700', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum=7 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0700start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionStartAbility_0700 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionStartAbility_0700 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0800 - * @tc.name : start new ability - * @tc.desc : Starting mainability2 with startability failed.(callback) - */ - it('ACTS_ExtensionStartAbility_0800', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 8 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect().assertFail(); - expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); - console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(()=>{ - done(); - },1000) - } - function onConnectCallback(element, remote) { - console.log(' onConnectCallback====> element=' + JSON.stringify(element)); - console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ExtensionStartAbility_0800 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0800start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_0900 - * @tc.name : start new ability - * @tc.desc : Starting mainability2 with startability succeeded.(callback) - */ - it('ACTS_ExtensionStartAbility_0900', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum=13 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent").assertTrue(); - console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility3).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0900start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionStartAbility_0900 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionStartAbility_0900 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - - }) - - /* - * @tc.number : ACTS_ExtensionStartAbility_1000 - * @tc.name : start new ability - * @tc.desc : Starting mainability2 with startability succeeded.(callback) - */ - it('ACTS_ExtensionStartAbility_1000', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum=14 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent").assertTrue(); - console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility3).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>1000start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionStartAbility_1000 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionStartAbility_1000 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - - }) - - /* - * @tc.number : ACTS_ExtensionTerminateSelf_0100 - * @tc.name : Use terminateself to terminate ability - * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(promise) - */ - it('ACTS_ExtensionTerminateSelf_0100', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 9 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function onConnectCallback(element, remote) { - console.log('onConnectCallback====> element=' + JSON.stringify(element)); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionTerminateSelf_0100 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionTerminateSelf_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - /* - * @tc.number : - * @tc.name : Use terminateself to terminate ability - * @tc.desc : Starting mainability2 with startAbility then terminateself ability failed.(promise) - */ - it('ACTS_ExtensionTerminateSelf_0200', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 10 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect().assertFail(); - expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(()=>{ - done(); - },1000) - } - function onConnectCallback(element, remote) { - console.log(' onConnectCallback====> element=' + JSON.stringify(element)); - console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug(' - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - }) - /* - * @tc.number : ACTS_ExtensionTerminateSelf_0300 - * @tc.name : Use terminateself to terminate ability - * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(callback) - */ - it('ACTS_ExtensionTerminateSelf_0300', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 11 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ - startresult = true - } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(true); - setTimeout(()=>{ - done() - },1000) - } - - function timeout() { - console.debug('in ACTS_ExtensionTerminateSelf_0300 timeout'); - if(flag == true) { - expect().assertFail(); - console.debug('ACTS_ExtensionTerminateSelf_0300 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, START_ABILITY_TIMEOUT); - - }) - /* - * @tc.number : ACTS_ExtensionTerminateSelf_0400 - * @tc.name : Use terminateself to terminate ability - * @tc.desc : Starting mainability2 with startAbility then terminateself ability failed.(callback) - */ - it('ACTS_ExtensionTerminateSelf_0400', 0, async function (done) { - let Subscriber - var flag = true - var startresult = false - globalThis.startnum = 12 - console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { - expect().assertFail(); - expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ - startresult = true - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - setTimeout(()=>{ - done(); - },1000) - } - function onConnectCallback(element, remote) { - console.log('ACTS_ExtensionTerminateSelf_0400 onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_ExtensionTerminateSelf_0400 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { - console.debug('ACTS_ExtensionTerminateSelf_0400 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - }) - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets deleted file mode 100755 index 198b3e4099bc53462227bffa2f9c2fcb31c19baa..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,20 +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 abilityTest from './Ability.test.ets' - -export default function testsuite(context) { - console.debug("====>in list.test====>"); - abilityTest(context) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json deleted file mode 100755 index 1d5966b3126c12b0f72496eff26aae2ac13868ba..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.acts.actsinterfacemultiusersextensiontest.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" - ] - } - ] - }, - { - "name": "com.acts.actsinterfacemultiusersextensiontest.MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait" - } - ], - "extensionAbilities": [ - { - "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", - "name": "com.acts.actsinterfacemultiusersextensiontest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - }, - { - "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", - "name": "com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION" - } - ], - "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.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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.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.MANAGE_LOCAL_ACCOUNTS", - "reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" - }, - { - "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", - "reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" - } - ] - } -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/app.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/app.json deleted file mode 100755 index 297408f961c12c8282f388072a9a728f23dd792a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.acts.killprocesshap", - "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn deleted file mode 100755 index b3dd9ae9bfabcba69c160f9853732a22e11c836c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsUsersKillProcessAppA") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsuserskillprocessappa_js_assets", - ":actsamsuserskillprocessappa_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsUsersKillProcessAppA" -} - -ohos_app_scope("actsamsuserskillprocessappa_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsuserskillprocessappa_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsuserskillprocessappa_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsuserskillprocessappa_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/Test.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 03ea5663aaf6c47ed95cf297988253434efa4f03..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne() { - console.debug("====>Publish CallBack ACTS_KillProcess====>"); -} - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - commonEvent.publish("ACTS_KillProcess", PublishCallBackOne); - } - - 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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json deleted file mode 100755 index f3d6af9ff0f4846f29937d70131c9ab872207b9b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.acts.killprocesshap.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" - ] - } - ] - } - ] - - } -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/app.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/app.json deleted file mode 100755 index 5a34634cb8274dc66cf178b0549d03ca6cd91032..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.acts.killprocessthirdhap", - "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn deleted file mode 100755 index 9e4027b42a84f1196a629e190d5d3ae474a94382..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsUsersKillProcessAppB") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsuserskillprocessappb_js_assets", - ":actsamsuserskillprocessappb_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsUsersKillProcessAppB" -} - -ohos_app_scope("actsamsuserskillprocessappb_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsuserskillprocessappb_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsuserskillprocessappb_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsuserskillprocessappb_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/Test.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 4f74e976dd4acc570297f0f07df0166b8c1919ea..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,58 +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 Ability from '@ohos.application.Ability' -import appManager from '@ohos.application.appManager' - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context - 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") - console.log("in killhap onForeground") - setTimeout(()=>{ - appManager.killProcessesByBundleName('com.example.killprocessthirdhap').then((data)=>{ - console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) - }) - },2000) - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json deleted file mode 100755 index 27d17718326befffec67b4dfbbc20d483b8e8ae7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.acts.killprocessthirdhap.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/app.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/app.json deleted file mode 100755 index 04957795c479c90fab9058c3ac12a07b543f6113..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.acts.killprocessthirdhap2", - "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn deleted file mode 100755 index 9e83279c41e965d1f4e07a362cc2ef5726f2c079..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsUsersKillProcessAppC") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsuserskillprocessappc_js_assets", - ":actsamsuserskillprocessappc_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsUsersKillProcessAppC" -} - -ohos_app_scope("actsamsuserskillprocessappc_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsuserskillprocessappc_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsuserskillprocessappc_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsuserskillprocessappc_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/Test.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 09e417a9ef3d968ab8fea897e8cfb02838e03ba7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,58 +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 Ability from '@ohos.application.Ability' -import appManager from '@ohos.application.appManager' - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context - 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") - console.log("in killhap onForeground") - setTimeout(()=>{ - appManager.killProcessesByBundleName('com.example.killprocessthirdhap2',(err,data)=>{ - console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) - }) - },2000) - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json deleted file mode 100755 index 1f73e0270c62b9cd341bef709512fefc58d092f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.acts.killprocessthirdhap2.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/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/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index 15f5bac6b6b5e18e3eff116651e87f98df4b8659..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,47 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate'); - } - onDestory(){ - console.log('ServiceAbility onDestory'); - } - onRequest(want,startId) { - console.log('ServiceAbility onRequest'); - commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", () => { - console.log(" Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - this.context.terminateSelf().then(()=>{ - console.log(" terminateSelf callback") - }) - }) - } - - onConnect(want) { - console.log('ServiceAbility onConnect'); - } - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect'); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index cd0377c3893f3fd32b9bdcbc1a8d089fa200e891..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,50 +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 file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - globalThis.abilityWant.parameters['timeout'] = 20000 - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - 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/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/app.json b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/app.json deleted file mode 100755 index 1a44bb9e690d0089cd5b7407bcb41183ba2838c8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsconnectabilitysystemabilitytest", - "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/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/Test.json b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/Test.json deleted file mode 100755 index fcdb809aa7d8a2ada304099cf50061bcbdfc0c18..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/Test.json +++ /dev/null @@ -1,31 +0,0 @@ - -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "120000", - "package": "com.example.actsconnectabilitysystemabilitytest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm switch -i 101" - ], - "teardown-command":[ - "acm delete -i 101" - ] - }, - { - "test-file-name": [ - "ActsConnectAbilitySystemAbilityTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - - ] -} - diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 171016091c757b720532da26f337c26228f1184a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,42 +0,0 @@ -import Ability from '@ohos.application.Ability' -// import commonEvent from '@ohos.commonEvent' - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceTest onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceTest onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceTest onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceTest onWindowStageDestroy") - } - - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceTest onForeground") - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceTest onBackground") - } - -}; diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index 2d427beac9c2e1551fc14bfb3348ee711aba8eab..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,167 +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 commonEvent from '@ohos.commonEvent' -import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' - -var conn = -1; -function publishCallBackOne () { - console.log("========Publish CallBack AMS_ConnectAbility_0100_commonEvent========"); -} -function publishCallBackTwo () { - console.log("========Publish CallBack AMS_ConnectAbility_0200_commonEvent========"); -} -function publishCallBackThree () { - console.log("========Publish CallBack AMS_ConnectAbility_0300_commonEvent========"); -} -function publishCallBackFour () { - console.log("========Publish CallBack AMS_ConnectAbility_0400_commonEvent========"); -} -function publishCallBackFive () { - console.log("========Publish CallBack AMS_ConnectAbility_0500_commonEvent========"); -} -function publishCallBackSix () { - console.log("========Publish CallBack AMS_ConnectAbility_0600_commonEvent========"); -} -function publishCallBackzero () { - console.log("========Publish CallBack AMSc_disonnectAbility_0100_commonEvent========"); -} -function publishCallBackttwo () { - console.log("========Publish CallBack AMSc_disonnectAbility_0200_commonEvent========"); -} - -export default class ServiceAbility extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - - console.log('ServiceAbility registerApplicationStateObserver begin'); - console.log('ServiceAbility registerApplicationStateObserver end, conn: ' + conn); - } - - onConnect(want) { - console.log('ServiceAbility onConnect, want:' + want.abilityName); - let extensionContext = this.context - if (want.action == "one") { - commonEvent.publish("AMS_ConnectAbility_0100_commonEvent", publishCallBackOne); - } - ; - if (want.action == "two") { - commonEvent.publish("AMS_ConnectAbility_0200_commonEvent", publishCallBackTwo); - } - ; - if (want.action == "Three") { - commonEvent.publish("AMS_ConnectAbility_0300_commonEvent", publishCallBackThree); - } - ; - if (want.action == "Four") { - commonEvent.publish("AMS_ConnectAbility_0400_commonEvent", publishCallBackFour); - } - ; - if (want.action == "Five") { - commonEvent.publish("AMS_ConnectAbility_0500_commonEvent", publishCallBackFive); - } - ; - if (want.action == "Six") { - commonEvent.publish("AMS_ConnectAbility_0600_commonEvent", publishCallBackSix); - } - ; - if (want.action == "Seven") { - extensionContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility2", - } - ); - }; - if (want.action == "Eight") { - extensionContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility3", - } - ); - }; - if (want.action == "Nine") { - console.log('connectAbility 111'); - let num = extensionContext.connectAbility( - { - bundleName: 'com.example.actsconnectabilitysystemabilitytest', - abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' - }) - setTimeout(()=>{ - extensionContext.disconnectAbility(num).then(()=>{ - console.log('in disconnectAbility'); - }) - },1000) - - }; - if (want.action == "Ten") { - console.log('connectAbility 222'); - let num = extensionContext.connectAbility( - { - bundleName: 'com.example.actsconnectabilitysystemabilitytest', - abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' - }) - setTimeout(()=>{ - extensionContext.disconnectAbility(num).then(()=>{ - console.log('in disconnectAbility2'); - }) - },1000) - - }; - if (want.action == "Ten one") { - console.log('connectAbility 333'); - let num = extensionContext.connectAbility( - { - bundleName: 'com.example.actsconnectabilitysystemabilitytest', - abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' - }) - setTimeout(()=>{ - extensionContext.disconnectAbility(2222).then(()=>{ - console.log('in disconnectAbility3'); - }) - },1000) - - }; - if (want.action == "Ten two") { - console.log('connectAbility 444'); - let num = extensionContext.connectAbility( - { - bundleName: 'com.example.actsconnectabilitysystemabilitytest', - abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' - }) - setTimeout(()=>{ - extensionContext.disconnectAbility(2222).then(()=>{ - console.log('in disconnectAbility4'); - }) - },1000) - - }; - } - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - commonEvent.publish("AMSc_disonnectAbility_0100_commonEvent",publishCallBackzero); - commonEvent.publish("AMSc_disonnectAbility_0200_commonEvent",publishCallBackttwo); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} - diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100755 index df24f31381247c3fb759bde5e61a6125066ecee0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,60 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility2 extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility2 onCreate'); - globalThis.abilityWant = want; - } - - onDestory(){ - console.log('ServiceAbility2 onDestory'); - } - - onRequest(want,startId) { - console.log('ServiceAbility2 onRequest'); - } - - onConnect(want) { - console.log('ServiceAbility2 onConnect'); - commonEvent.publish("AMS_ConnectAbility_0700_commonEvent", () => { - console.log("publish Publish AMS_ConnectAbility_0700_commonEvent callback"); - }) - commonEvent.publish("AMS_ConnectAbility_0900_commonEvent", () => { - console.log("publish Publish AMS_ConnectAbility_0900_commonEvent callback"); - }) - commonEvent.publish("AMS_ConnectAbility_1000_commonEvent", () => { - console.log("publish Publish AMS_ConnectAbility_1000_commonEvent callback"); - }) - commonEvent.publish("AMS_ConnectAbility_1100_commonEvent", () => { - console.log("publish Publish AMS_ConnectAbility_1100_commonEvent callback"); - }) - commonEvent.publish("AMS_ConnectAbility_1200_commonEvent", () => { - console.log("publish Publish AMS_ConnectAbility_1200_commonEvent callback"); - }) - } - - - onDisconnect(want) { - console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility2 onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 85d2f648a55a82c8f8d4abd60faa6c35433363de..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,51 +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.ets" -import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World1111111') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets deleted file mode 100755 index 203485bd7e41ab2793c45ffd8d4f417a62501583..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +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 abilityTest from './manyusersabilitytest.test.ets' -export default function testsuite(context) { - - abilityTest(context) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets deleted file mode 100755 index 9d2c5861584ec7d76c4b8e08fd3249708afc67cf..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets +++ /dev/null @@ -1,814 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' - - -var subscriberInfoStartAbility_0100 = { - events: ["AMS_ConnectAbility_0100_commonEvent"], -}; -var subscriberInfoStartAbility_0200 = { - events: ["AMS_ConnectAbility_0200_commonEvent"], -}; -var subscriberInfoStartAbility_0300 = { - events: ["AMS_ConnectAbility_0300_commonEvent"], -}; -var subscriberInfoStartAbility_0400 = { - events: ["AMS_ConnectAbility_0400_commonEvent"], -}; -var subscriberInfoStartAbility_0500 = { - events: ["AMS_ConnectAbility_0500_commonEvent"], -}; -var subscriberInfoStartAbility_0600 = { - events: ["AMS_ConnectAbility_0600_commonEvent"], -}; -var subscriberInfoStartAbility_0700 = { - events: ["AMS_ConnectAbility_0700_commonEvent"], -}; -var subscriberInfoStartAbility_0800 = { - events: ["AMS_ConnectAbility_0800_commonEvent"], -}; -var subscriberInfoStartAbility_0900 = { - events: ["AMS_ConnectAbility_0900_commonEvent"], -}; - -var subscriberInfoStartAbility_1000 = { - events: ["AMS_ConnectAbility_1000_commonEvent"], -}; - -var subscriberInfoStartAbility_1100 = { - events: ["AMS_ConnectAbility_1100_commonEvent"], -}; - -var subscriberInfoStartAbility_1200 = { - events: ["AMS_ConnectAbility_1200_commonEvent"], -}; -var unsubscriberInfoStartAbility_0100 = { - events: ["AMSc_disonnectAbility_0100_commonEvent"], -}; -var unsubscriberInfoStartAbility_0200 = { - events: ["AMSc_disonnectAbility_0200_commonEvent"], -}; - - -const START_ABILITY_TIMEOUT = 1000; -globalThis.number = 0; - -export default function abilityTest(abilityContext) { - describe('ActssystemabilityTest', function () { - function onFailedCallBack(code) { - console.log('ACTS_ConnectAbility_0200 Connectability errcode:' + code); - } - - /* - * @tc.number: ACTS_ConnectAbility_0100 - * @tc.name: Connects a service ability - * @tc.desc: Connects a service ability - */ - it('ACTS_ConnectAbility_0100', 0, async function (done) { - console.log('ACTS_ConnectAbility_0100====ACTS_ConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); - console.debug("====>ACTS_ConnectAbility_0100 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ConnectAbility_0100 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - - } - - - commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { - console.debug("====>ACTS_ConnectAbility_0100 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('AMS_ConnectAbility_0100 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ConnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "one", - }, - ); - console.debug("====>ACTS_ConnectAbility_0100 4 "); - - }) - - /* - * @tc.number: ACTS_ConnectAbility_0200 - * @tc.name: Connects a service ability - * @tc.desc: Connects a service ability - */ - it('ACTS_ConnectAbility_0200', 0, async function (done) { - console.log('ACTS_ConnectAbility_0200====Subscribe CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0200_commonEvent"); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { - console.debug("====>Create Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - function timeout() { - console.debug('AMS_ConnectAbility_0200 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbilityone", - action: "two", - }, - { - onFailed: onFailedCallBack, - }, - ); - }) - - /* - * @tc.number: ACTS_DisconnectAbility_0100 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_DisconnectAbility_0100', 0, async function (done) { - console.log('ACTS_DisconnectAbility_0100====ACTS_DisconnectAbility_0100 5 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - console.debug("====>ACTS_DisconnectAbility_0100 6====>"); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_DisconnectAbility_0100 6====>"); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0300).then(async (data) => { - console.debug("====>ACTS_DisconnectAbility_0100 2 Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - setTimeout(()=> - { - done() - }, 1000)}; - function timeout() { - expect().assertFail(); - console.debug('AMS_DonnectAbility_0300 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_DisconnectAbility_0100 3====>"); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Three", - }, - ); - console.debug("====>ACTS_DisconnectAbility_0100 4====>"); - }) - - /* - * @tc.number: ACTS_DisconnectAbility_0200 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_DisconnectAbility_0200', 0, async function (done) { - console.log('ACTS_DisconnectAbility_0200 1====ACTS_DisconnectAbility_0200 3 CallBack1 data:====>" + JSON.stringify(data)); - commonEvent.createSubscriber(unsubscriberInfoStartAbility_0100).then(async (data) => { - console.debug("====>ACTS_DisconnectAbility_0200 6 Subscriber====>"); - subscriberdisconnect = data; - await commonEvent.subscribe(subscriberdisconnect, subscribedisconnectback); - console.debug("====>ACTS_DisconnectAbility_0200 1111 connectAbility1====>"); - - console.debug("====>ACTS_DisconnectAbility_0200 1111 connectAbility2====>"); - console.debug("====>ACTS_DisconnectAbility_0200 66 Subscriber====>"); - abilityContext.disconnectAbility( - 999, - (error, data) => { - console.log('ACTS_DisconnectAbility_0200 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - }) - } - function subscribedisconnectback(err, data) { - console.debug("====>ACTS_DisconnectAbility_0200 7 CallBack2 data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberdisconnect, () => { - console.debug('unsubscribe subscriberdisconnect'); - commonEvent.unsubscribe(subscriber, () => { - console.debug('unsubscribe subscriber') - clearTimeout(id); - expect().assertFail(); - done(); - }) - }) - } - function timeout() { - console.debug('ACTS_DisconnectAbility_0200 8 timeout'); - commonEvent.unsubscribe(subscriberdisconnect, () => { - console.debug('unsubscribe subscriberdisconnect'); - commonEvent.unsubscribe(subscriber, () => { - console.debug('unsubscribe subscriber') - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('ACTS_DisconnectAbility_0200 9 DisconnectAbility result errCode : ' + error.code + " data: " + data) - console.debug("====>ACTS_DisconnectAbility_0200 99 Subscriber====>"); - setTimeout(() => { - done(); - }, 1000) - }); - }) - }) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0400).then(async (data) => { - console.debug("====>ACTS_DisconnectAbility_0200 10 Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Four", - }, - ); - console.debug("====>connId is:====>" + JSON.stringify(connId)); - console.debug("====>ACTS_DisconnectAbility_0200 1010 Subscriber====>"); - }) - function unSubscribeCallback() { - console.debug("====>ACTS_DisconnectAbility_0200 1111 UnSubscribe CallBack====>"); - done(); - } - }) - - /* - * @tc.number: ACTS_DisconnectAbility_0300 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_DisconnectAbility_0300', 0, async function (done) { - console.log('ACTS_DisconnectAbility_0300====ACTS_DisconnectAbility_0300 4 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0500_commonEvent"); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('ACTS_DisconnectAbility_0300 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0500).then(async (data) => { - console.debug("====>ACTS_DisconnectAbility_0300 1 Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>ACTS_DisconnectAbility_0300 6 CallBack====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - expect().assertFail(); - console.debug('AMS_ConnectAbility_0500 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('ACTS_DisconnectAbility_0300 7 DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_DisconnectAbility_0300 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Five", - }, - ); - console.debug("====>ACTS_DisconnectAbility_0300 4 "); - }) - - /* - * @tc.number: ACTS_DisconnectAbility_0400 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_DisconnectAbility_0400', 0, async function (done) { - console.log('ACTS_DisconnectAbility_0400 1====ACTS_DisconnectAbility_0400 3 CallBack1 data:====>" + JSON.stringify(data)); - commonEvent.createSubscriber(unsubscriberInfoStartAbility_0200).then(async (data) => { - console.debug("====>ACTS_DisconnectAbility_0400 6 Subscriber====>"); - subscriberdisconnect = data; - await commonEvent.subscribe(subscriberdisconnect, subscribedisconnectback); - console.debug("====>ACTS_DisconnectAbility_0400 1111 connectAbility1====>"); - - console.debug("====>ACTS_DisconnectAbility_0400 1111 connectAbility2====>"); - console.debug("====>ACTS_DisconnectAbility_0400 66 Subscriber====>"); - abilityContext.disconnectAbility( - 999, - (error, data) => { - console.log('ACTS_DisconnectAbility_0400 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - }) - } - function subscribedisconnectback(err, data) { - console.debug("====>ACTS_DisconnectAbility_0400 7 CallBack2 data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberdisconnect, () => { - console.debug('unsubscribe subscriberdisconnect'); - commonEvent.unsubscribe(subscriber, () => { - console.debug('unsubscribe subscriber') - clearTimeout(id); - expect().assertFail(); - done(); - }) - }) - } - function timeout() { - console.debug('ACTS_DisconnectAbility_0400 8 timeout'); - commonEvent.unsubscribe(subscriberdisconnect, () => { - console.debug('unsubscribe subscriberdisconnect'); - commonEvent.unsubscribe(subscriber, () => { - console.debug('unsubscribe subscriber') - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('ACTS_DisconnectAbility_0400 9 DisconnectAbility result errCode : ' + error.code + " data: " + data) - console.debug("====>ACTS_DisconnectAbility_0400 99 Subscriber====>"); - setTimeout(() => { - done(); - }, 1000) - }); - }) - }) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0600).then(async (data) => { - console.debug("====>ACTS_DisconnectAbility_0400 10 Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Six", - }, - ); - console.debug("====>connId is:====>" + JSON.stringify(connId)); - console.debug("====>ACTS_DisconnectAbility_0400 1010 Subscriber====>"); - }) - function unSubscribeCallback() { - console.debug("====>ACTS_DisconnectAbility_0400 1111 UnSubscribe CallBack====>"); - done(); - } - }) - - /* - * @tc.number: ACTS_ExtensionConnectAbility_0100 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_ExtensionConnectAbility_0100', 0, async function (done) { - console.log('ACTS_ExtensionConnectAbility_0100====ACTS_ExtensionConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0700_commonEvent"); - console.debug("====>ACTS_ExtensionConnectAbility_0100 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionConnectAbility_0100 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0700).then(async (data) => { - console.debug("====>ACTS_ExtensionConnectAbility_0100 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - expect().assertFail(); - console.debug('ACTS_ExtensionConnectAbility_0100 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionConnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Seven", - }, - ); - console.debug("====>ACTS_ExtensionConnectAbility_0100 4 "); - }) - - /* - * @tc.number: ACTS_ExtensionConnectAbility_0200 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_ExtensionConnectAbility_0200', 0, async function (done) { - console.log('ACTS_ExtensionConnectAbility_0200====ACTS_ExtensionConnectAbility_0200 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0800_commonEvent"); - console.debug("====>ACTS_ExtensionConnectAbility_0200 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionConnectAbility_0200 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0800).then(async (data) => { - console.debug("====>ACTS_ExtensionConnectAbility_0200 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - console.debug('ACTS_ExtensionConnectAbility_0200 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionConnectAbility_0200 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Eight", - }, - ); - console.debug("====>ACTS_ExtensionConnectAbility_0200 4 "); - }) - - /* - * @tc.number: ACTS_ExtensionDisconnectAbility_0100 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_ExtensionDisconnectAbility_0100', 0, async function (done) { - console.log('ACTS_ExtensionDisconnectAbility_0100====ACTS_ExtensionDisconnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0900_commonEvent"); - console.debug("====>ACTS_ExtensionDisconnectAbility_0100 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0100 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0900).then(async (data) => { - console.debug("====>ACTS_ExtensionDisconnectAbility_0100 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - expect().assertFail(); - console.debug('ACTS_ExtensionDisconnectAbility_0100 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionDisconnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Nine", - }, - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0100 4 "); - }) - - /* - * @tc.number: ACTS_ExtensionDisconnectAbility_0200 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_ExtensionDisconnectAbility_0200', 0, async function (done) { - console.log('ACTS_ExtensionDisconnectAbility_0200====ACTS_ExtensionDisconnectAbility_0200 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_1000_commonEvent"); - console.debug("====>ACTS_ExtensionDisconnectAbility_0200 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0200 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_1000).then(async (data) => { - console.debug("====>ACTS_ExtensionDisconnectAbility_0200 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - expect().assertFail(); - console.debug('ACTS_ExtensionDisconnectAbility_0200 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionDisconnectAbility_0200 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Ten", - }, - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0200 4 "); - }) - - /* - * @tc.number: ACTS_ExtensionDisconnectAbility_0300 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_ExtensionDisconnectAbility_0300', 0, async function (done) { - console.log('ACTS_ExtensionDisconnectAbility_0300====ACTS_ExtensionDisconnectAbility_0300 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_1100_commonEvent"); - console.debug("====>ACTS_ExtensionDisconnectAbility_0300 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0300 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_1100).then(async (data) => { - console.debug("====>ACTS_ExtensionDisconnectAbility_0300 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - console.debug('ACTS_ExtensionDisconnectAbility_0300 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionDisconnectAbility_0300 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Ten one", - }, - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0300 4 "); - }) - - /* - * @tc.number: ACTS_ExtensionDisconnectAbility_0400 - * @tc.name: DisConnects a service ability - * @tc.desc: DisConnects a service ability - */ - it('ACTS_ExtensionDisconnectAbility_0400', 0, async function (done) { - console.log('ACTS_ExtensionDisconnectAbility_0400====ACTS_ThirdPartyExtensionDisconnectAbility_0400 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_1200_commonEvent"); - console.debug("====>ACTS_ExtensionDisconnectAbility_0400 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0400 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - commonEvent.createSubscriber(subscriberInfoStartAbility_1200).then(async (data) => { - console.debug("====>ACTS_ExtensionDisconnectAbility_0400 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - }) - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - function timeout() { - console.debug('ACTS_ExtensionDisconnectAbility_0400 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionDisconnectAbility_0400 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsconnectabilitysystemabilitytest", - abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - action: "Ten two", - }, - ); - console.debug("====>ACTS_ExtensionDisconnectAbility_0400 4 "); - }) - }) -} - - diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/module.json b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/module.json deleted file mode 100755 index 486c0cf0f18ffae6f0c18d6a68e00a2813d42047..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/module.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsconnectabilitysystemabilitytest.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - }, - { - "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.actsconnectabilitysystemabilitytest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", - "reason": "ceshi" - }, - { - "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", - "reason": "ceshi" - }, - { - "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/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/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/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/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/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/app.json b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/app.json deleted file mode 100755 index 7ce2b709a13ec669ca664fd4b981930e4b738a86..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsextensionconnectabilitytest", - "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/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/Test.json b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/Test.json deleted file mode 100755 index d8239bcb30fa3492098a8415759df374c9ad35ae..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/Test.json +++ /dev/null @@ -1,42 +0,0 @@ - -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "120000", - "package": "com.example.actsextensionconnectabilitytest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm switch -i 101" - ], - "teardown-command":[ - "acm delete -i 101" - ] - }, - { - "test-file-name": [ - "ActsExtensionConnectAbilityTest.hap", - "actsServiceAbilityRelyHap.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "PushKit", - "push": [ - "actsServiceAbilityRelyHap.hap->/data/app/actsServiceAbilityRelyHap.hap"] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 777 /data/app/*.hap" - ] - } - ] -} - diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index d38bb6c9cfaf1ff168e13958c960eddb36f1f709..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,25 +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.stageOnCreateRun = 1; - globalThis.startnum = 0 - globalThis.stageContext = this.context; - - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 53688df76245c8f78d15ce89d5f1006c304bc066..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,55 +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("AbilityMultiInstanceTest onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceTest onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceTest onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceTest onWindowStageDestroy") - } - - - onForeground() { - // Ability has brought to foreground - console.log("AbilityMultiInstanceTest onForeground") - } - - onBackground() { - // Ability has back to background - console.log("AbilityMultiInstanceTest onBackground") -} - -}; diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index 056b97a1f64c7a394092f0f62dc7aaa036c9572b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,62 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from '@ohos.commonEvent' -function publishCallBackOne () { - console.log("========Publish CallBack AMS_ConnectAbility_0300_commonEvent========"); -} -var conn = -1; -export default class ServiceAbility extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - - console.log('ServiceAbility registerApplicationStateObserver begin'); - console.log('ServiceAbility registerApplicationStateObserver end, conn: ' + conn); - } - - onConnect(want) { - console.log('ServiceAbility onConnect, want:' + want.abilityName); - let extensionContext = this.context - if (want.action == "Three") { - console.log('connectAbility 111'); - let num = extensionContext.connectAbility( - { - bundleName: 'com.example.actsserviceabilityrelytest', - abilityName: 'com.example.actsserviceabilityrelytest.ServiceAbility' - }) - setTimeout(()=>{ - extensionContext.disconnectAbility(num).then(()=>{ - console.log('in disconnectAbility'); - }) - },1000) - - }; - commonEvent.publish("AMS_ConnectAbility_0300_commonEvent", publishCallBackOne); - - }; - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} - diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100755 index ba9ac7a26e61787138040dbc539c8f371fb6be0e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,60 +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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from '@ohos.commonEvent' -function publishCallBackOne () { - console.log("========Publish CallBack AMS_ConnectAbility_0400_commonEvent========"); -} -var conn = -1; -export default class ServiceAbility2 extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - - console.log('ServiceAbility registerApplicationStateObserver begin'); - console.log('ServiceAbility registerApplicationStateObserver end, conn: ' + conn); - } - - onConnect(want) { - console.log('ServiceAbility onConnect, want:' + want.abilityName); - let extensionContext = this.context - - console.log('connectAbility 222'); - let num = extensionContext.connectAbility( - { - bundleName: 'com.example.actsserviceabilityrelytest', - abilityName: 'com.example.actsserviceabilityrelytest.ServiceAbility' - }) - setTimeout(()=>{ - extensionContext.disconnectAbility(num).then(()=>{ - console.log('in disconnectAbility2'); - }) - },1000) - commonEvent.publish("AMS_ConnectAbility_0400_commonEvent", publishCallBackOne); - - }; - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} - diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 74b56925172fb24e0c1cfea3c4793053a18335ed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,52 +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.ets" -import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World1111111') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/List.test.ets deleted file mode 100755 index 8ca5c0a649d0f1c1d950e83ba3787618ed18ba0a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +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 abilityTest from './actsextensionconnectabilitytest.test.ets' -export default function testsuite(context) { - - abilityTest(context) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/actsextensionconnectabilitytest.test.ets b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/actsextensionconnectabilitytest.test.ets deleted file mode 100755 index 9c790e1f1c2eba363c3765f4102d8dcbf0f1ea72..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/actsextensionconnectabilitytest.test.ets +++ /dev/null @@ -1,291 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' - - -var subscriberInfoStartAbility_0100 = { - events: ["AMS_ConnectAbility_0100_commonEvent"], -}; -var subscriberInfoStartAbility_0200 = { - events: ["AMS_ConnectAbility_0200_commonEvent"], -}; -var subscriberInfoStartAbility_0300 = { - events: ["AMS_ConnectAbility_0300_commonEvent"], -}; -var subscriberInfoStartAbility_0400 = { - events: ["AMS_ConnectAbility_0400_commonEvent"], -}; -const START_ABILITY_TIMEOUT = 5000; -globalThis.number = 0; - -export default function abilityTest(abilityContext) { - describe('ActsExtensionConnectAbilityTest', function () { - - it('ACTS_ConnectAbility_0300', 0, async function (done) { - console.log('ACTS_ConnectAbility_0300====ACTS_ConnectAbility_0300 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); - console.debug("====>ACTS_ConnectAbility_0300 5 "); - abilityContext.disconnectAbility( - connId, - (err, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) - } - ); - console.debug("====>ACTS_ConnectAbility_0300 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - - } - - - commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { - console.debug("====>ACTS_ConnectAbility_0300 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility({ - bundleName: "com.example.actsserviceabilityrelytest", - abilityName: "com.example.actsserviceabilityrelytest.ServiceAbility", - }, (err, data) => { - console.log('ACTS_ProcessManage SystemAppA onShowProcess startAbility startServiceAbility: ' - + JSON.stringify(err) + ", " + JSON.stringify(data)) - }) - }) - - - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_ConnectAbility_0300 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (err, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) - }); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ConnectAbility_0300 4 "); - - }) - - it('ACTS_ConnectAbility_0400', 0, async function (done) { - console.log('ACTS_ConnectAbility_0400====ACTS_ConnectAbility_0400 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0200_commonEvent"); - console.debug("====>ACTS_ConnectAbility_0400 5 "); - abilityContext.disconnectAbility( - connId, - (err, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) - } - ); - console.debug("====>ACTS_ConnectAbility_0400 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - - } - - - commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { - console.debug("====>ACTS_ConnectAbility_0400 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - console.debug("====>ACTS_ConnectAbility_0400 3 "); - connId = await abilityContext.connectAbility({ - bundleName: "com.example.actsserviceabilityrelytest", - abilityName: "com.example.actsserviceabilityrelytest.ServiceAbility", - }, (err, data) => { - console.log('ACTS_ProcessManage SystemAppA onShowProcess startAbility startServiceAbility: ' - + JSON.stringify(err) + ", " + JSON.stringify(data)) - }) - console.debug("====>ACTS_ConnectAbility_0400 4 "); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_ConnectAbility_0400 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (err, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) - }); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - - }) - - it('ACTS_ExtensionConnectAbility_0300', 0, async function (done) { - console.log('ACTS_ExtensionConnectAbility_0300====ACTS_ExtensionConnectAbility_0300 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0300_commonEvent"); - console.debug("====>ACTS_ExtensionConnectAbility_0300 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionConnectAbility_0300 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - - } - - - commonEvent.createSubscriber(subscriberInfoStartAbility_0300).then(async (data) => { - console.debug("====>ACTS_ExtensionConnectAbility_0300 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsextensionconnectabilitytest", - abilityName: "com.example.actsextensionconnectabilitytest.ServiceAbility", - action:"Three", - }).then(()=>{ - console.debug("====>startAbility end====>"); - }) - console.debug("====>ACTS_ExtensionConnectAbility_0300 4 "); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_ExtensionConnectAbility_0300 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>ACTS_ExtensionConnectAbility_0300 3 "); - - }) - - it('ACTS_ExtensionConnectAbility_0400', 0, async function (done) { - console.log('ACTS_ExtensionConnectAbility_0400====ACTS_ExtensionConnectAbility_0400 7 CallBack data:====>" + JSON.stringify(data)); - clearTimeout(id); - expect(data.event).assertEqual("AMS_ConnectAbility_0400_commonEvent"); - console.debug("====>ACTS_ExtensionConnectAbility_0400 5 "); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - } - ); - console.debug("====>ACTS_ExtensionConnectAbility_0400 6 "); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - - } - - - commonEvent.createSubscriber(subscriberInfoStartAbility_0400).then(async (data) => { - console.debug("====>ACTS_ExtensionConnectAbility_0400 2 Subscriber1====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - console.debug("====>ACTS_ExtensionConnectAbility_0400 3 "); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.actsextensionconnectabilitytest", - abilityName: "com.example.actsextensionconnectabilitytest.ServiceAbility2", - action:"Four", - }, - ); - console.debug("====>ACTS_ExtensionConnectAbility_0400 4 "); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe CallBack1====>"); - setTimeout(() => { - done(); - }, 1000) - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_ExtensionConnectAbility_0400 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - - }) - - - - }) -} - - diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/module.json b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/module.json deleted file mode 100755 index 791a6b2649a45387be1f24c8a119a8019dde22dd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/module.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsextensionconnectabilitytest.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.actsextensionconnectabilitytest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - }, - { - "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.actsextensionconnectabilitytest.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/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/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/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/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/BUILD.gn b/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/BUILD.gn deleted file mode 100755 index eeaa839ab5651544fceacb0492e3618fa45e35de..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("actsServiceAbilityRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsserviceabilityrelytest_js_assets", - ":actsserviceabilityrelytest_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "actsServiceAbilityRelyHap" -} - -ohos_app_scope("actsserviceabilityrelytest_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsserviceabilityrelytest_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsserviceabilityrelytest_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsserviceabilityrelytest_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index ee9582e7ccea9b9033c8c0c7e6ff7ae132768e92..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' -import commonEvent from '@ohos.commonEvent' -function publishCallBackOne () { - console.log("========Publish CallBack AMS_ConnectAbility_0100_commonEvent========"); -} -function publishCallBackTwo () { - console.log("========Publish CallBack AMS_ConnectAbility_0200_commonEvent========"); -} - -export default class ServiceAbility extends ServiceExtensionAbility { - onCreate(want) { - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - } - - onConnect(want) { - console.log('ServiceAbility onConnect, want:' + want.abilityName); - commonEvent.publish("AMS_ConnectAbility_0100_commonEvent", publishCallBackOne); - commonEvent.publish("AMS_ConnectAbility_0200_commonEvent", publishCallBackTwo); - }; - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} - diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 244e5564eaec4b2f2286ef82d607c74d3622cf7f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,65 +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 file from '@system.file'; - -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/app.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/app.json deleted file mode 100644 index 584a67f5b5bb132615ff829664cd57d60fbb81e8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.extensionmodule", - "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/BUILD.gn b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/BUILD.gn deleted file mode 100644 index 360d5286174b91725f07b84aa736e5808b7d6dcc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsExtensionModuleRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsextensionmodulerelyhap_js_assets", - ":actsamsextensionmodulerelyhap_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsExtensionModuleRelyHap" -} - -ohos_app_scope("actsamsextensionmodulerelyhap_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsextensionmodulerelyhap_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsextensionmodulerelyhap_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsextensionmodulerelyhap_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/Test.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index acbfa37240911791c0a2a6f43f3e0349c89729bd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,99 +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' -import rpc from '@ohos.rpc' - -var connection = -1; -let options = { - onConnect: function(elementName, proxy) { - console.log("mxh onConnect success"); - if (proxy == null) { - console.log("mxh proxy == null"); - return; - } - let option = new rpc.MessageOption(); - let data = new rpc.MessageParcel(); - let reply = new rpc.MessageParcel(); - data.writeInt(1); - data.writeInt(99); - proxy.sendRequest(1, data, reply, option); - let msg = reply.readInt(); - console.log("mxh onConnect msg:" + msg); - }, - - onDisconnect: function() {console.log("mxh onDisconnect success");}, - onFailed: function() {console.log("mxh onFailed");} -} -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - console.log('mxh MainAbility onCreate is called' + want + launchParam); - } - - onDestroy() { - console.log('mxh MainAbility onDestroy is called'); - } - - onWindowStageCreate(windowStage) { - console.log('mxh MainAbility onWindowStageCreate is called'); - let context = this.context; - globalThis.startServiceExtAbility = (() => { - console.log("mxh startServiceExtAbility begin"); - var want = { - "bundleName": "com.example.ohosproject.hmservice", - "abilityName": "ServiceExtAbility", - } - context.startAbility(want).then((data) => { - console.info("mxh startAbility success:" + JSON.stringify(data)); - }).catch((error) => { - console.error("mxh startAbility failed:" + JSON.stringify(error)); - }) - console.log("mxh startServiceExtAbility end"); - }) - - globalThis.connectServiceExtAbility = (() => { - console.log("mxh connectServiceExtAbility begin"); - var want = { - "bundleName": "com.example.ohosproject.hmservice", - "abilityName": "ServiceExtAbility", - } - connection = context.connectAbility(want, options); - console.log("mxh connectServiceExtAbility end, connection:" + connection); - }) - - globalThis.disconnectServiceExtAbility = (() => { - console.log("mxh disconnectServiceExtAbility begin"); - context.disconnectAbility(connection).then((data) => { - console.info("mxh startAbility success:" + JSON.stringify(data)); - }).catch((error) => { - console.error("mxh startAbility failed:" + JSON.stringify(error)); - }); - console.log("mxh disconnectServiceExtAbility end, connection:" + connection); - }) - - windowStage.setUIContent(this.context, 'pages/index/index', null); - } - - onWindowStageDestroy() { - console.log('mxh MainAbility onWindowStageDestroy is called'); - } - - onForeground() { - console.log('mxh MainAbility onForeground is called'); - } - - onBackground() { - console.log('mxh MainAbility onBackground is called'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100644 index 90f7a672c8aee22514cf65cefec20efcd37a77d6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,48 +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 Extension from '@ohos.application.ServiceExtensionAbility' -import commonEvent from '@ohos.commonEvent' - - -export default class ServiceExtAbility extends Extension { - onCreate(want) { - console.info('mxh ServiceAbility onCreate**'); - - } - - onRequest(want, startId) { - console.info('mxh ServiceAbility onRequest**'); - } - - onConnect(want) { - console.info('mxh ServiceAbility onConnect**'); - commonEvent.publish("ACTS_ConnectAbility_0100_CommonEvent", { - parameters: { - extensionAbilityInfo : JSON.stringify(this.context.extensionAbilityInfo), - } - } ,(err) => { - console.log("Demo Publish CallBack MainAbility_Start_CommonEvent") - }); - console.log('Demo SerivceAbilityServer OnConnect start 1'); - } - - onDisconnect(want) { - console.info('mxh ServiceAbility onDisConnect**'); - } - - onDestroy() { - console.info('mxh ServiceAbility onDestroy**'); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json deleted file mode 100644 index c7430ec217ebe78fb5bb9fadb1760fe164abd376..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.acts.pmvendorappservice.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": [ - { - "name": "ServiceExtAbility", - "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "permissions": [ - "ohos.permission.USE_BLUETOOTH" - ], - "metadata": [ - { - "name": "ohos.extension.form", - "value": "MainAbility", - "resource": "@profile:form_config" - } - ], - "visible": true, - "type": "service" - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 15bb5b9d0b2f791ec430c1c2dab6c49a0286748f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityStageContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/app.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/app.json deleted file mode 100644 index ca8f7004d343c7f10966e3e83685fffad86cb6e1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.staticextensioninfotest", - "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/BUILD.gn b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/BUILD.gn deleted file mode 100644 index 73fef6379681ae8e6c33dd92041162ae91ce012c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsStaticExtensionInfoRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsstaticextensioninforelyhap_js_assets", - ":actsamsstaticextensioninforelyhap_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsStaticExtensionInfoRelyHap" -} - -ohos_app_scope("actsamsstaticextensioninforelyhap_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsstaticextensioninforelyhap_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsstaticextensioninforelyhap_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsstaticextensioninforelyhap_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/Test.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 5b95af0dbbe7e5517cc22a1f0f054c01aeae64a1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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("ACTS_ProcessManage VendorAppService MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_ProcessManage VendorAppService MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageDestroy") - } - - async onForeground() { - // Ability has brought to foreground - console.log("ACTS_ProcessManage VendorAppService MainAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("ACTS_ProcessManage VendorAppService MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100644 index 28f072533fd06d5aaaeb4d49a2d26dc6299b59c1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - } - - onConnect(want) { - console.log('ServiceAbility2 onConnect, abilityName:' + want.abilityName); - console.log('ServiceAbility2 onConnect, action:' + want.action); - globalThis.extensionContext = this.context - if (want.action == 'getExtensionInfoTest') { - commonEvent.publish("ACTS_ConnectAbility_0200_CommonEvent", { - parameters: { - hapModuleInfo2: JSON.stringify(this.context.currentHapModuleInfo), - applicationInfo2: JSON.stringify(this.context.applicationInfo) - } - } ,(err) => { - console.log("MainAbility Publish CallBack MainAbility_Start_CommonEvent") - }); - console.log('stub SerivceAbilityServer OnConnect start 2'); - } - } - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json deleted file mode 100644 index e26e51946e95afa2320d70e3791c6ee7bf2e1699..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.staticextensioninfotest.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.staticextensioninfotest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - } - ], - "requestPermissions": [ - { - "name":"ohos.permission.GET_BUNDLE_INFO", - "reason":"need use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", - "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name":"ohos.permission.GET_RUNNING_INFO", - "reason":"need use ohos.permission.GET_RUNNING_INFO" - } - ] - } -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100644 index 20b9883a45ee725433e0921e326dee155d2c9ccd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,54 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -import commonEvent from "@ohos.commonEvent" - -export default class ServiceAbility extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - console.log('ServiceAbility registerApplicationStateObserver begin'); - } - - onConnect(want) { - console.log('ServiceAbility onConnect, want:' + want.abilityName); - globalThis.extensionContext = this.context - if (want.action == 'getExtensionInfo') { - commonEvent.publish("ACTS_ConnectAbility_0100_CommonEvent", { - parameters: { - hapModuleInfo: JSON.stringify(this.context.currentHapModuleInfo), - applicationInfo: JSON.stringify(this.context.applicationInfo), - } - } ,(err) => { - console.log("MainAbility Publish CallBack MainAbility_Start_CommonEvent") - }); - console.log('stub SerivceAbilityServer OnConnect start 1'); - } - - } - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100644 index 706c332a067d755cbc39c879518a2e56dca052e7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,471 +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 commonEvent from "@ohos.commonEvent" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -const START_ABILITY_TIMEOUT = 5000; -var subscriberInfoStartAbility_0100 = { - events: ["ACTS_ConnectAbility_0100_CommonEvent"], -}; -var subscriberInfoStartAbility_0200 = { - events: ["ACTS_ConnectAbility_0200_CommonEvent"], -}; - -export default function abilityTest(abilityContext) { - - describe('ActsExtensionAbilityTest', function () { - - /* - * @tc.number: ACTS_getExtensionInfo_0100 - * @tc.name: Start the system permission application to query static information about Extension - * @tc.desc: Enable application ras to query the Extension static information. Verify the query information. - Enable application ras to connect to serviceAbility - */ - it('ACTS_getExtensionInfo_0100', 0, async function (done) { - console.log('ACTS_getExtensionInfo_0100 gyq ====ACTS_getExtensionInfo_0100_Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ACTS_ConnectAbility_0100_CommonEvent") { - clearTimeout(id); - checkHapModuleInfo(JSON.parse(data.parameters['hapModuleInfo'])) - checkApplicationInfo(JSON.parse(data.parameters['applicationInfo'])) - expect(data.event).assertEqual("ACTS_ConnectAbility_0100_CommonEvent"); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - done(); - } - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { - console.debug("====>ACTS_getExtensionInfo_0100_Create Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.staticextensioninfo", - abilityName: "com.example.staticextensioninfo.ServiceAbility", - action: "getExtensionInfo" - } - ); - console.log('ACTS_getExtensionInfo_0100 ConnectAbility connId : ' + connId); - }) - - function unSubscribeCallback() { - console.debug("====>ACTS_getExtensionInfo_0100_UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_ConnectAbility_0100 timeout'); - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - - - function checkHapModuleInfo(data) { - console.log("checkHapModuleInfo start " + data); - console.log("checkHapModuleInfo name : " + data.name); - console.log("checkHapModuleInfo description : " + data.description); - console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); - console.log("checkHapModuleInfo icon : " + data.icon); - console.log("checkHapModuleInfo label : " + data.label); - console.log("checkHapModuleInfo labelId : " + data.labelId); - console.log("checkHapModuleInfo iconId : " + data.iconId); - console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg); - console.log("checkHapModuleInfo supportedModes : " + data.supportedModes); - console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); - for (var j = 0; j < data.reqCapabilities.length; j++) { - console.log("checkHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); - } - console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); - for (var j = 0; j < data.deviceTypes.length; j++) { - console.log("checkHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); - } - console.log("checkHapModuleInfo moduleName : " + data.moduleName); - console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); - console.log("checkHapModuleInfo installationFree : " + data.installationFree); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.backgroundImg)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.reqCapabilities)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.abilityInfo)).assertEqual(true); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.mainAbilityName)).assertEqual("string"); - console.log("checkHapModuleInfo_expect_typeof_end") - expect(data.name).assertEqual("phone"); - expect(data.description).assertEqual("$string:phone_entry_dsc"); - expect(data.descriptionId).assertEqual(undefined); - expect(data.icon).assertEqual("$media:icon"); - expect(data.label).assertEqual("$string:entry_label"); - expect(data.labelId).assertEqual(undefined); - expect(data.iconId).assertEqual(undefined); - expect(data.backgroundImg).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - expect(data.reqCapabilities.length).assertEqual(0); - expect(data.reqCapabilities[0]).assertEqual(undefined); - expect(data.deviceTypes.length).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.moduleName).assertEqual("phone") - expect(data.mainAbilityName).assertEqual("MainAbility"); - expect(data.installationFree).assertEqual(undefined); - console.log("checkHapModuleInfo end " + data); - } - function checkApplicationInfo(data) { - console.log("checkApplicationInfo start " + data); - console.log("checkApplicationInfo name : " + data.name); - console.log("checkApplicationInfo description : " + data.description); - console.log("checkApplicationInfo descriptionId : " + data.descriptionId); - console.log("checkApplicationInfo systemApp : " + data.systemApp); - console.log("checkApplicationInfo enabled : " + data.enabled); - console.log("checkApplicationInfo label : " + data.label) - console.log("checkApplicationInfo labelId : " + data.labelId); - console.log("checkApplicationInfo icon : " + data.icon); - console.log("checkApplicationInfo iconId : " + data.iconId); - console.log("checkApplicationInfo process : " + data.process); - console.log("checkApplicationInfo supportedModes : " + data.supportedModes); - console.log("checkApplicationInfo moduleSourceDirs length : " + data.moduleSourceDirs.length); - for (var j = 0; j < data.moduleSourceDirs.length; j++) { - console.log("checkApplicationInfo data.moduleSourceDirs[" + j + "] : " + data.moduleSourceDirs[j]); - } - console.log("checkApplicationInfo permissions length : " + data.permissions.length); - for (var j = 0; j < data.permissions.length; j++) { - console.log("checkApplicationInfo data.permissions[" + j + "] : " + data.permissions[j]); - } - console.log("checkApplicationInfo moduleInfos length : " + data.moduleInfos.length); - for (var j = 0; j < data.moduleInfos.length; j++) { - console.log("checkApplicationInfo data.moduleInfos[" + j + "].moduleName : " + data.moduleInfos[j].moduleName); - console.log("checkApplicationInfo data.moduleInfos[" + j + "].moduleSourceDir:" + - data.moduleInfos[j].moduleSourceDir); - } - console.log("checkApplicationInfo entryDir : " + data.entryDir); - console.log("checkApplicationInfo codePath : " + data.codePath); - console.log("checkApplicationInfo removable: " + data.removable); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.systemApp)).assertEqual("boolean"); - expect(typeof (data.enabled)).assertEqual("boolean"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.iconId)).assertEqual("string"); - expect(typeof (data.process)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true); - expect(Array.isArray(data.permissions)).assertEqual(true); - expect(Array.isArray(data.moduleInfos)).assertEqual(true); - expect(typeof (data.entryDir)).assertEqual("string"); - expect(typeof (data.codePath)).assertEqual("string"); - expect(typeof (data.removable)).assertEqual("boolean"); - console.log("checkApplicationInfo_expect_typeof_end") - expect(data.name).assertEqual("com.example.staticextensioninfo"); - expect(data.description).assertEqual("$string:description_application"); - expect(data.descriptionId).assertLarger(0); - expect(data.systemApp).assertEqual(true); - expect(data.enabled).assertEqual(true); - expect(data.label).assertEqual("$string:app_name"); - expect(data.labelId).assertEqual("16777216"); - expect(data.icon).assertEqual(""); - expect(data.iconId).assertEqual("16777224"); - expect(data.process).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - expect(data.moduleSourceDirs.length).assertEqual(1); - expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticextensioninfo/phone"); - expect(data.moduleInfos.length).assertEqual(1); - expect(data.moduleInfos[0].moduleName).assertEqual("phone"); - expect(data.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticextensioninfo/phone"); - expect(data.entryDir).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfo" + - "/phone"); - expect(data.codePath).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfo"); - expect(data.removable).assertEqual(true); - console.log("checkApplicationInfo end " + data); - } - }) - - /* - * @tc.number: ACTS_getExtensionInfo_0200 - * @tc.name: Apply StaticExtensionInfo. Connect to StaticExtensionInfoTest to query static information - about an Extension - * @tc.desc: Enabling an application to connect to StaticExtensionInfo. Connecting to StaticExtensionInfoTest - To query static information about an Extension. Verifying the query information - */ - it('ACTS_getExtensionInfo_0200', 0, async function (done) { - console.log('ACTS_getExtensionInfo_0200====ACTS_getExtensionInfo_0200_Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ACTS_ConnectAbility_0200_CommonEvent") { - clearTimeout(id); - checkHapModuleInfo_0200(JSON.parse(data.parameters['hapModuleInfo2'])) - checkApplicationInfo_0200(JSON.parse(data.parameters['applicationInfo2'])) - expect(data.event).assertEqual("ACTS_ConnectAbility_0200_CommonEvent"); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { - console.debug("====>ACTS_getExtensionInfo_0200_Create Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack);. - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.staticextensioninfotest", - abilityName: "com.example.staticextensioninfotest.ServiceAbility", - action: "getExtensionInfoTest" - } - ); - console.log('ACTS_getExtensionInfo_0200 ConnectAbility connId : ' + connId); - }) - - function unSubscribeCallback() { - console.debug("====>ACTS_getExtensionInfo_0200_UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_ConnectAbility_0200 timeout'); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - - - function checkHapModuleInfo_0200(data) { - console.log("checkHapModuleInfo2 start " + data); - console.log("checkHapModuleInfo2 name : " + data.name); - console.log("checkHapModuleInfo2 description : " + data.description); - console.log("checkHapModuleInfo2 descriptionId : " + data.descriptionId); - console.log("checkHapModuleInfo2 icon : " + data.icon); - console.log("checkHapModuleInfo2 label : " + data.label); - console.log("checkHapModuleInfo2 labelId : " + data.labelId); - console.log("checkHapModuleInfo2 iconId : " + data.iconId); - console.log("checkHapModuleInfo2 backgroundImg : " + data.backgroundImg); - console.log("checkHapModuleInfo2 supportedModes : " + data.supportedModes); - console.log("checkHapModuleInfo2 reqCapabilities length : " + data.reqCapabilities.length); - for (var j = 0; j < data.reqCapabilities.length; j++) { - console.log("checkHapModuleInfo2 data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); - } - console.log("checkHapModuleInfo2 deviceTypes length : " + data.deviceTypes.length); - for (var j = 0; j < data.deviceTypes.length; j++) { - console.log("checkHapModuleInfo2 data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); - } - console.log("checkHapModuleInfo2 moduleName : " + data.moduleName); - console.log("checkHapModuleInfo2 mainAbilityName : " + data.mainAbilityName); - console.log("checkHapModuleInfo2 installationFree : " + data.installationFree); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.backgroundImg)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.reqCapabilities)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.abilityInfo)).assertEqual(true); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.mainAbilityName)).assertEqual("string"); - console.log("checkHapModuleInfo_expect_typeof_end") - expect(data.name).assertEqual("phone"); - expect(data.description).assertEqual("$string:phone_entry_dsc"); - expect(data.descriptionId).assertEqual(undefined); - expect(data.icon).assertEqual("$media:icon"); - expect(data.label).assertEqual("$string:entry_label"); - expect(data.labelId).assertEqual(undefined); - expect(data.iconId).assertEqual(undefined); - expect(data.backgroundImg).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - expect(data.reqCapabilities.length).assertEqual(0); - expect(data.reqCapabilities[0]).assertEqual(undefined); - expect(data.deviceTypes.length).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.moduleName).assertEqual("phone") - expect(data.mainAbilityName).assertEqual("MainAbility"); - expect(data.installationFree).assertEqual(undefined); - console.log("checkHapModuleInfo end " + data); - } - function checkApplicationInfo_0200(data) { - console.log("checkApplicationInfo2 start " + data); - console.log("checkApplicationInfo2 name : " + data.name); - console.log("checkApplicationInfo2 description : " + data.description); - console.log("checkApplicationInfo2 descriptionId : " + data.descriptionId); - console.log("checkApplicationInfo2 systemApp : " + data.systemApp); - console.log("checkApplicationInfo2 enabled : " + data.enabled); - console.log("checkApplicationInfo2 label : " + data.label) - console.log("checkApplicationInfo2 labelId : " + data.labelId); - console.log("checkApplicationInfo2 icon : " + data.icon); - console.log("checkApplicationInfo2 iconId : " + data.iconId); - console.log("checkApplicationInfo2 process : " + data.process); - console.log("checkApplicationInfo2 supportedModes : " + data.supportedModes); - console.log("checkApplicationInfo2 moduleSourceDirs length : " + data.moduleSourceDirs.length); - for (var j = 0; j < data.moduleSourceDirs.length; j++) { - console.log("checkApplicationInfo2 data.moduleSourceDirs[" + j + "] : " + data.moduleSourceDirs[j]); - } - console.log("checkApplicationInfo2 permissions length : " + data.permissions.length); - for (var j = 0; j < data.permissions.length; j++) { - console.log("checkApplicationInfo2 data.permissions[" + j + "] : " + data.permissions[j]); - } - console.log("checkApplicationInfo2 moduleInfos length : " + data.moduleInfos.length); - for (var j = 0; j < data.moduleInfos.length; j++) { - console.log("checkApplicationInfo2 data.moduleInfos[" + j + "].moduleName : " + data.moduleInfos[j].moduleName); - console.log("checkApplicationInfo2 data.moduleInfos[" + j + "].moduleSourceDir:" + - data.moduleInfos[j].moduleSourceDir); - } - console.log("checkApplicationInfo2 entryDir : " + data.entryDir); - console.log("checkApplicationInfo2 codePath : " + data.codePath); - console.log("checkApplicationInfo2 removable: " + data.removable); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.systemApp)).assertEqual("boolean"); - expect(typeof (data.enabled)).assertEqual("boolean"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.iconId)).assertEqual("string"); - expect(typeof (data.process)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true); - expect(Array.isArray(data.permissions)).assertEqual(true); - expect(Array.isArray(data.moduleInfos)).assertEqual(true); - expect(typeof (data.entryDir)).assertEqual("string"); - expect(typeof (data.codePath)).assertEqual("string"); - expect(typeof (data.removable)).assertEqual("boolean"); - console.log("checkApplicationInfo_expect_typeof_end") - expect(data.name).assertEqual("com.example.staticextensioninfotest"); - expect(data.description).assertEqual("$string:description_application"); - expect(data.descriptionId).assertLarger(0); - expect(data.systemApp).assertEqual(true); - expect(data.enabled).assertEqual(true); - expect(data.label).assertEqual("$string:app_name"); - expect(data.labelId.length).assertLarger(0); - expect(data.icon).assertEqual(""); - expect(data.iconId.length).assertLarger(0); - expect(data.process).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - expect(data.moduleSourceDirs.length).assertEqual(1); - expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticextensioninfotest/phone"); - expect(data.moduleInfos.length).assertEqual(1); - expect(data.moduleInfos[0].moduleName).assertEqual("phone"); - expect(data.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticextensioninfotest/phone"); - expect(data.entryDir).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfotest" + - "/phone"); - expect(data.codePath).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfotest"); - expect(data.removable).assertEqual(true); - console.log("checkApplicationInfo end " + data); - } - }) - - /* - * @tc.number: ACTS_getExtensionInfo_0300 - * @tc.name: Apply StaticExtensionInfo. Connect to StaticExtensionInfoTest to query static information - about an Extension - * @tc.desc: Verify configuration module.json connect service application query property information - */ - it('ACTS_getExtensionInfo_0300', 0, async function (done) { - console.log('ACTS_getExtensionInfo_0300====ACTS_getExtensionInfo_0300_Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "ACTS_ConnectAbility_0100_CommonEvent") { - clearTimeout(id); - checkExtensionAbilityInfo(JSON.parse(data.parameters['extensionAbilityInfo'])) - expect(data.event).assertEqual("ACTS_ConnectAbility_0100_CommonEvent"); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - done(); - } - } - commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { - console.debug("====>ACTS_getExtensionInfo_0300_Create Subscriber====>"); - subscriber = data; - await commonEvent.subscribe(subscriber, subscribeCallBack); - connId = await abilityContext.connectAbility( - { - bundleName: "com.example.extensionmodule", - abilityName: "ServiceExtAbility", - } - ); - console.log('ACTS_getExtensionInfo_0300 ConnectAbility connId : ' + connId); - }) - - function unSubscribeCallback() { - console.debug("====>ACTS_getExtensionInfo_0300_UnSubscribe CallBack====>"); - } - - function timeout() { - expect().assertFail(); - abilityContext.disconnectAbility( - connId, - (error, data) => { - console.log('DisconnectAbility_0300 result errCode : ' + error.code + " data: " + data) - done(); - }, - ); - console.debug('ACTS_ConnectAbility_0300 timeout'); - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - - - function checkExtensionAbilityInfo(data) { - console.log("checkHapModuleInfo_expect_typeof_end3") - console.log("checkAbilityInfo metadata length : " + data.metadata.length); - console.log("checkAbilityInfo metadata length : " + data.metadata[0].name); - expect(data.metadata[0].name).assertEqual("ohos.extension.form"); - expect(data.metadata[0].value).assertEqual("MainAbility"); - expect(data.metadata[0].resource).assertEqual("@profile:form_config"); - expect(data.bundleName).assertEqual("com.example.extensionmodule"); - expect(data.moduleName).assertEqual("phone"); - expect(data.name).assertEqual("ServiceExtAbility"); - expect(data.permissions.length).assertEqual(1); - expect(data.permissions[0]).assertEqual("ohos.permission.USE_BLUETOOTH"); - expect(data.isVisible).assertEqual(true); - expect(data.extensionAbilityType).assertLarger(0); - expect(data.readPermission).assertEqual(""); - expect(data.writePermission).assertEqual(""); - expect(data.enabled).assertEqual(true) - console.log("checkExtensionAbilityInfo3 end " + data); - } - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/app.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/app.json deleted file mode 100644 index 51ee16f27e59280d635c2735b336a197fbdd1266..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.staticinformationmultihappackage", - "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/BUILD.gn b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/BUILD.gn deleted file mode 100644 index 2e0822e7659a40f014de29c173e08b1b63da6374..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsStaticARelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsstaticarelyhap_js_assets", - ":actsamsstaticarelyhap_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsStaticARelyHap" -} - -ohos_app_scope("actsamsstaticarelyhap_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsstaticarelyhap_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsstaticarelyhap_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsstaticarelyhap_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/Test.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 746e6b2a45aaa50268da2c044122d97d77ded280..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,83 +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' -import commonEvent from '@ohos.commonEvent' - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("ACTS_getAbilityInfo_0400 MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_getAbilityInfo_0400 MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("ACTS_getAbilityInfo_0400 MainAbility onForeground") - if (globalThis.abilityWant.action == 'startHapA') { - globalThis.abilityContext.startAbility({ - bundleName: "com.example.staticinformationmultihappackage", - abilityName: "com.example.feature.MainAbility", - action: "startHapB" - }, (error, data) => { - console.log('ACTS_getAbilityInfo_0400 MainAbility onForeground - startAbility restart singleton: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - commonEvent.publish("MainAbility_Start_CommonEvent_multi_hap_entry", { - parameters: { - hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), - applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), - abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) - } - }, (err) => { - console.log("ACTS_getAbilityInfo_0400 MainAbility Publish CallBack onForeground") - }); - } - console.log("ACTS_getAbilityInfo_0400 MainAbility onForeground") - - if (globalThis.abilityWant.action == 'multiple') { - commonEvent.publish("MainAbility_Start_CommonEvent_multiple_hap_entry", { - parameters: { - hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), - applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), - abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) - } - }, (err) => { - console.log("ACTS_getAbilityInfo_0400 MainAbility Publish CallBack onForeground") - }); - } - } - - onBackground() { - // Ability has back to background - console.log("ACTS_getAbilityInfo_0400 MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json deleted file mode 100644 index 0cd086184c1bc7228f5f2bdc7620ffa1d1b2ce42..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "module": { - "name": "com.example.staticinformationmultihappackage", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.staticinformationmultihappackage.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" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", - "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name":"ohos.permission.GET_RUNNING_INFO", - "reason":"need use ohos.permission.GET_RUNNING_INFO" - }, - { - "name":"ohos.permission.USE_BLUETOOTH", - "reason":"need use ohos.permission.USE_BLUETOOTH" - } - ] - } -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/app.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/app.json deleted file mode 100644 index 51ee16f27e59280d635c2735b336a197fbdd1266..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.staticinformationmultihappackage", - "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/BUILD.gn b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/BUILD.gn deleted file mode 100644 index 2550f6187977034683736e2bbe87a3bf4e7e499b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsStaticBRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsstaticbrelyhap_js_assets", - ":actsamsstaticbrelyhap_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsStaticBRelyHap" -} - -ohos_app_scope("actsamsstaticbrelyhap_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsstaticbrelyhap_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsstaticbrelyhap_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsstaticbrelyhap_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/Test.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/Test.json deleted file mode 100644 index ba2697bb640e6f7c293aa11a828cdc3d4836958b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index f2a2876e65a16199cf03d14888a83239c2aa430b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,62 +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' -import commonEvent from '@ohos.commonEvent' - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("ACTS_getAbilityInfo_0400 MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_getAbilityInfo_0400 MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("ACTS_getAbilityInfo_0400 MainAbility onForeground") - if (globalThis.abilityWant.action == 'startHapB') { - commonEvent.publish("MainAbility_Start_CommonEvent_multi_hap_feature", { - parameters: { - hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), - applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), - abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) - } - }, (err) => { - console.log("ACTS_getAbilityInfo_0400 MainAbility Publish CallBack onForeground") - }); - } - } - - onBackground() { - // Ability has back to background - console.log("ACTS_getAbilityInfo_0400 MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json deleted file mode 100644 index 2f74083c67495ec0c7229a36186c25574d37e028..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "module": { - "name": "com.example.feature", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.feature.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" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", - "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name":"ohos.permission.GET_RUNNING_INFO", - "reason":"need use ohos.permission.GET_RUNNING_INFO" - }, - { - "name":"ohos.permission.USE_BLUETOOTH", - "reason":"need use ohos.permission.USE_BLUETOOTH" - } - ] - } -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100644 index 28dec8f5ba3d882ecdaf5386e437632745adcdcb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,166 +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. - */ -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; -import commonEvent from '@ohos.commonEvent'; -import bundle from '@ohos.bundle'; -import missionManager from '@ohos.application.missionManager'; - -const BUNDLE_PATHS = [['/data/ActsAmsStaticQueryTestTwoRelyHap.hap'],['/data/ActsAmsStaticARelyHap.hap']]; -const BUNDLE_NAMES = ['com.example.staticquerytesttwo','com.example.staticinformationmultihappackage']; -const PATHS_COUNT = 2; -const BUNDLE_COUNT = 2; -const MAX_MISSION_NUM = 1024; -var subscriberInfo = { - events: ['MainAbility_Start_CommonEvent_multi_hap_entryB', 'MainAbility_Start_CommonEvent_multiple_hap_entry'] -}; - -function getMissionId() { - return new Promise(async (resolve, reject) => { - var missionId = -1; - var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); - console.log('======>ACTS_getAbilityInfo_0500 getMissionId missionInfos<=======' + missionInfos); - for (let i = 0; i < missionInfos.length; i++) { - console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i])) - if ((missionInfos[i].want.abilityName == "com.example.staticinformationmultiple.MainAbility") && - (missionInfos[i].runningState == 0)) { - missionId = missionInfos[i].missionId; - break; - } - } - console.log('======>ACTS_getAbilityInfo_0500 getMissionId resolve missionId<=======' + missionId); - resolve(missionId); - }) -} - -export default function abilityTest(abilityContext) { - describe('ActsAbilityTest', function () { - - // beforeEach(async (done) => { - // console.log('======>beforeEach ininin<======='); - // let installer = await bundle.getBundleInstaller(); - // var count = 0; - - // for (let i = 0; i < PATHS_COUNT; i++) { - // installer.install(BUNDLE_PATHS[i], { - // userId: 100, - // installFlag: 1, - // isKeepData: false - // }, (err, data) => { - // count++; - // console.log('======>beforeEach install finish <=======' + err.code); - // console.log('======>beforeEach install finish <=======' + data.status); - // console.log('======>beforeEach install finish <=======' + data.statusMessage); - // if (count == BUNDLE_COUNT) { - // done(); - // } - // }) - // } - // }) - - // afterEach(async (done) => { - // let installer = await bundle.getBundleInstaller(); - // var count = 0; - // var testMissionId; - - // testMissionId = await getMissionId(); - // console.log('======>afterEach test missionId<=======' + testMissionId); - // await missionManager.moveMissionToFront(testMissionId); - - // for (let i = 0; i < BUNDLE_COUNT; i++) { - // installer.uninstall(BUNDLE_NAMES[i], { - // userId: 100, - // installFlag: 1, - // isKeepData: false - // }, (err, data) => { - // count++; - // console.log('======>afterEach uninstall finish <=======' + err.code); - // console.log('======>afterEach uninstall finish <=======' + data.status); - // console.log('======>afterEach uninstall finish <=======' + data.statusMessage); - // if (count == BUNDLE_COUNT) { - // done(); - // } - // }) - // } - // }) - - /** - * @tc.number: ACTS_getAbilityInfo_0400 - * @tc.name: Starting singleton ability the second time does triggers onNewWant. - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_getAbilityInfo_0500', 0, async function (done) { - console.log("ACTS_getAbilityInfo_0500 --- start") - var Subscriber; - var EntryHap = false; - var FeatureHap = false; - - abilityContext.startAbility({ - bundleName: "com.example.staticquerytesttwo", - abilityName: "com.example.staticquerytesttwo.MainAbility", - action:"startmultiple" - }, (error, data) => { - console.log('ACTS_getAbilityInfo_0500 - startAbility start HapA: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_getAbilityInfo_0500====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - console.debug("ACTS_getAbilityInfo_0500====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_getAbilityInfo_0500====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - if (data.event == 'MainAbility_Start_CommonEvent_multi_hap_entryB') { - EntryHap = true; - console.log("ACTS_getAbilityInfo_0500====> MainAbility_Start_CommonEvent_multi_hap_entryB") - let abilityInfo = JSON.parse(data.parameters['abilityInfo']) - let hapModuleInfo = JSON.parse(data.parameters['hapModuleInfo']) - let applicationInfo =JSON.parse(data.parameters['applicationInfo']) - console.log("ACTS_getAbilityInfo_0500_entry_abilityInfo" + abilityInfo.name) - console.log("ACTS_getAbilityInfo_0500_entry_applicationInfo" + applicationInfo.name) - console.log("ACTS_getAbilityInfo_0500_entry_hapModuleInfo" + hapModuleInfo.name) - expect(abilityInfo.name).assertEqual("com.example.staticquerytesttwo.MainAbility"); - expect(applicationInfo.name).assertEqual("com.example.staticquerytesttwo"); - expect(hapModuleInfo.name).assertEqual("com.example.staticquerytesttwo"); - } else if (data.event == 'MainAbility_Start_CommonEvent_multiple_hap_entry'){ - FeatureHap = true; - console.log("ACTS_getAbilityInfo_0500====> MainAbility_Start_CommonEvent_multi_hap_feature") - let abilityInfo1 = JSON.parse(data.parameters['abilityInfo']) - let hapModuleInfo1 = JSON.parse(data.parameters['hapModuleInfo']) - let applicationInfo1 =JSON.parse(data.parameters['applicationInfo']) - console.log("ACTS_getAbilityInfo_0500_feature_abilityInfo" + abilityInfo1.name) - console.log("ACTS_getAbilityInfo_0500_feature_applicationInfo" + applicationInfo1.name) - console.log("ACTS_getAbilityInfo_0500_feature_hapModuleInfo" + hapModuleInfo1.name) - expect(abilityInfo1.name).assertEqual("com.example.staticinformationmultihappackage.MainAbility"); - expect(applicationInfo1.name).assertEqual("com.example.staticinformationmultihappackage"); - expect(hapModuleInfo1.name).assertEqual("com.example.staticinformationmultihappackage"); - } - if(EntryHap && FeatureHap){ - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - function UnSubscribeCallback() { - console.debug("ACTS_getAbilityInfo_0500====>UnSubscribe CallBack====>"); - done(); - } - }) - - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100644 index a1bf03287d1a40aaa5d8e434a945d3361f295768..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,162 +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. - */ -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; -import commonEvent from '@ohos.commonEvent'; -import bundle from '@ohos.bundle'; -import missionManager from '@ohos.application.missionManager'; - -const BUNDLE_PATH = ['/data/ActsAmsStaticARelyHap.hap','/data/ActsAmsStaticBRelyHap.hap']; -const BUNDLE_NAME = ['com.example.staticinformationmultihappackage']; -const PATHS_COUNT = 1; -const BUNDLE_COUNT = 1; -const MAX_MISSION_NUM = 1024; -var subscriberInfo = { - events: ['MainAbility_Start_CommonEvent_multi_hap_entry', 'MainAbility_Start_CommonEvent_multi_hap_feature'], -}; - -function getMissionId() { - return new Promise(async (resolve, reject) => { - var missionId = -1; - var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); - console.log('======>ACTS_getAbilityInfo_0400 getMissionId missionInfos<=======' + missionInfos); - for (let i = 0; i < missionInfos.length; i++) { - console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i])) - if ((missionInfos[i].want.abilityName == "com.example.staticinformationmultihap.MainAbility") && - (missionInfos[i].runningState == 0)) { - missionId = missionInfos[i].missionId; - break; - } - } - console.log('======>ACTS_getAbilityInfo_0400 getMissionId resolve missionId<=======' + missionId); - resolve(missionId); - }) -} - -export default function abilityTest(abilityContext) { - describe('ActsAbilityTest', function () { - - beforeEach(async (done) => { - let installer = await bundle.getBundleInstaller(); - var count = 0; - installer.install(BUNDLE_PATH, { - userId: 100, - installFlag: 1, - isKeepData: false - }, (err, data) => { - count++; - console.log('======>ACTS_getAbilityInfo_0400 beforeEach install finish<=======' + err.code); - console.log('======>ACTS_getAbilityInfo_0400 beforeEach install finish<=======' + data.status); - console.log('======>ACTS_getAbilityInfo_0400 beforeEach install finish<=======' - + data.statusMessage); - if(count == PATHS_COUNT){ - done(); - } - }) - }) - - afterEach(async (done) => { - let installer = await bundle.getBundleInstaller(); - var count = 0; - var testMissionId; - - testMissionId = await getMissionId(); - console.log('======>ACTS_getAbilityInfo_0400 afterEach test missionId<=======' + testMissionId); - await missionManager.moveMissionToFront(testMissionId); - console.log('======>ACTS_getAbilityInfo_0400 afterEach test move<======='); - installer.uninstall(BUNDLE_NAME, { - userId: 100, - installFlag: 1, - isKeepData: false - }, (err, data) => { - count++; - console.log('======>ACTS_getAbilityInfo_0400 afterEach uninstall finish<=======' + err.code); - console.log('======>ACTS_getAbilityInfo_0400 afterEach uninstall finish<=======' + data.status); - console.log('======>ACTS_getAbilityInfo_0400 afterEach uninstall finish<=======' - + data.statusMessage); - if(count == BUNDLE_COUNT){ - done(); - } - }) - }) - - /** - * @tc.number: ACTS_getAbilityInfo_0400 - * @tc.name: Starting singleton ability the second time does triggers onNewWant. - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_getAbilityInfo_0400', 0, async function (done) { - console.log("ACTS_getAbilityInfo_0400 --- start") - var Subscriber; - var EntryHap = false; - var FeatureHap = false; - - abilityContext.startAbility({ - bundleName: "com.example.staticinformationmultihappackage", - abilityName: "com.example.staticinformationmultihappackage.MainAbility", - action:"startHapA" - }, (error, data) => { - console.log('ACTS_getAbilityInfo_0400 - startAbility start HapA: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_getAbilityInfo_0400====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - console.debug("ACTS_getAbilityInfo_0400====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_getAbilityInfo_0400====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - if (data.event == 'MainAbility_Start_CommonEvent_multi_hap_entry') { - EntryHap = true; - console.log("ACTS_getAbilityInfo_0400====> MainAbility_Start_CommonEvent_multi_hap_entry") - let abilityInfo = JSON.parse(data.parameters['abilityInfo']) - let hapModuleInfo = JSON.parse(data.parameters['hapModuleInfo']) - let applicationInfo =JSON.parse(data.parameters['applicationInfo']) - console.log("ACTS_getAbilityInfo_0400_entry_abilityInfo" + abilityInfo.name) - console.log("ACTS_getAbilityInfo_0400_entry_applicationInfo" + applicationInfo.name) - console.log("ACTS_getAbilityInfo_0400_entry_hapModuleInfo" + hapModuleInfo.name) - expect(abilityInfo.name).assertEqual("com.example.staticinformationmultihappackage.MainAbility"); - expect(applicationInfo.name).assertEqual("com.example.staticinformationmultihappackage"); - expect(hapModuleInfo.name).assertEqual("com.example.staticinformationmultihappackage"); - } else if (data.event == 'MainAbility_Start_CommonEvent_multi_hap_feature'){ - FeatureHap = true; - console.log("ACTS_getAbilityInfo_0400====> MainAbility_Start_CommonEvent_multi_hap_feature") - let abilityInfo1 = JSON.parse(data.parameters['abilityInfo']) - let hapModuleInfo1 = JSON.parse(data.parameters['hapModuleInfo']) - let applicationInfo1 =JSON.parse(data.parameters['applicationInfo']) - console.log("ACTS_getAbilityInfo_0400_feature_abilityInfo" + abilityInfo1.name) - console.log("ACTS_getAbilityInfo_0400_feature_applicationInfo" + applicationInfo1.name) - console.log("ACTS_getAbilityInfo_0400_feature_hapModuleInfo" + hapModuleInfo1.name) - expect(abilityInfo1.name).assertEqual("com.example.feature.MainAbility"); - expect(applicationInfo1.name).assertEqual("com.example.staticinformationmultihappackage"); - expect(hapModuleInfo1.name).assertEqual("com.example.feature"); - } - if(EntryHap && FeatureHap){ - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - function UnSubscribeCallback() { - console.debug("ACTS_getAbilityInfo_0400====>UnSubscribe CallBack====>"); - done(); - } - }) - - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/BUILD.gn b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/BUILD.gn deleted file mode 100644 index 54cfa87f7eb8b953381b5c160c94db84024bfe8d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsAmsStaticQueryTestTwoRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actsamsstaticquerytesttworelyhap_js_assets", - ":actsamsstaticquerytesttworelyhap_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsAmsStaticQueryTestTwoRelyHap" -} - -ohos_app_scope("actsamsstaticquerytesttworelyhap_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actsamsstaticquerytesttworelyhap_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actsamsstaticquerytesttworelyhap_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actsamsstaticquerytesttworelyhap_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/SecondMainAbility/SecondMainAbility.ts b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/SecondMainAbility/SecondMainAbility.ts deleted file mode 100644 index 346d72f2ed1eb6ba133007edd9cbb6f5aa5baa00..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/SecondMainAbility/SecondMainAbility.ts +++ /dev/null @@ -1,65 +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' -import commonEvent from '@ohos.commonEvent' - -export default class SecondAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("SecondAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("SecondAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("SecondAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index", null) - globalThis.ability2Context = this.context; - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("SecondAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("SecondAbility onForeground") - if (globalThis.abilityWant.action == 'getAbilityContext2') { - commonEvent.publish("SecondAbility_Start_CommonEvent_ability", { - parameters: { - hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), - applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), - abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) - } - } ,(err) => { - console.log("MainAbility Publish CallBack MainAbility_Start_CommonEvent") - }); - console.log('stub SerivceAbilityServer OnConnect start 2'); - } - } - - onBackground() { - // Ability has back to background - console.log("SecondAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 966ded012ca6e039819b546671a166b0b0c38c62..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,65 +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.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/test/DataUriUtilsJsSt.test.js b/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/test/DataUriUtilsJsSt.test.js deleted file mode 100644 index a3edd3e47aaa3fad9b934009ab8bb5f2096bc349..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/test/DataUriUtilsJsSt.test.js +++ /dev/null @@ -1,369 +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 dataUriUtils from '@ohos.ability.dataUriUtils' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('ActsDataUriUtilsTest', function () { - -/* -* @tc.number: ACTS_GetIdSync_0100 -* @tc.name: GetIdSync : Obtains the ID attached to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_GetIdSync_0100', 0, function (done) { - console.log('dataUriUtils getIdSync start1'); - var result = dataUriUtils.getId("com.ix.dataUriUtils/1221"); - console.log('dataUriUtils getIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("number"); - expect(result).assertEqual(1221); - console.log('dataUriUtils getIdSync_test start1 successful'); - done(); - }) - -/* -* @tc.number: ACTS_GetIdSync_0200 -* @tc.name: GetIdSync : Obtains the ID attached to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_GetIdSync_0200', 0, function (done) { - console.log('dataUriUtils getIdSync start2 '); - var result = dataUriUtils.getId("com.ix.dataUriUtils1221"); - console.log('dataUriUtils getIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("number"); - expect(result).assertEqual(-1); - console.log('dataUriUtils getIdSync_test start2 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_GetIdSync_0300 -* @tc.name: GetIdSync : Obtains the ID attached to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_GetIdSync_0300', 0, function (done) { - console.log('dataUriUtils getIdSync start3 '); - var result = dataUriUtils.getId("com.ix.dataUriUtils/11234567890"); - console.log('dataUriUtils getIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("number"); - expect(result).assertEqual(11234567890); - console.log('dataUriUtils getIdSync_test start3 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_GetIdSync_0400 -* @tc.name: GetIdSync : Obtains the ID attached to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_GetIdSync_0400', 0, function (done) { - console.log('dataUriUtils getIdSync start4 '); - var result = dataUriUtils.getId("com.ix.dataUriUtils"); - console.log('dataUriUtils getIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("number"); - expect(result).assertEqual(-1); - console.log('dataUriUtils getIdSync_test start4 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_GetIdSync_0500 -* @tc.name: GetIdSync : Obtains the ID attached to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_GetIdSync_0500', 0, function (done) { - console.log('dataUriUtils getIdSync start5 '); - var result = dataUriUtils.getId("com.ix.dataUriUtils/-777"); - console.log('dataUriUtils getIdSync URI : ' + result);//-777 - - expect(typeof(result)).assertEqual("number"); - expect(result).assertEqual(-777); - console.log('dataUriUtils getIdSync_test start5 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_AttachIdSync_0100 -* @tc.name: Attaches the given ID to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_AttachIdSync_0100',0, function (done) { - console.log('dataUriUtils attachIdSync start1 '); - var idint = 1122; - var result = dataUriUtils.attachId("com.ix.dataUriUtils",idint); - console.log('dataUriUtils attachIdSync URI :' + result) - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/1122"); - console.log('dataUriUtils attachIdSync_test start1 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_AttachIdSync_0200 -* @tc.name: Attaches the given ID to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_AttachIdSync_0200',0, function (done) { - console.log('dataUriUtils attachIdSync start2 '); - var idint = 0; - var result = dataUriUtils.attachId("com.ix.dataUriUtils/777",idint); - console.log('dataUriUtils attachIdSync URI :' + result) - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/777/0"); - console.log('dataUriUtils attachIdSync_test start2 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_AttachIdSync_0300 -* @tc.name: Attaches the given ID to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_AttachIdSync_0300',0, function (done) { - console.log('dataUriUtils attachIdSync start3 '); - var idint = 456789; - var result = dataUriUtils.attachId("com.ix.dataUriUtils/123",idint); - console.log('dataUriUtils attachIdSync URI :' + result) - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/123/456789"); - console.log('dataUriUtils attachIdSync_test start3 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_AttachIdSync_0400 -* @tc.name: Attaches the given ID to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_AttachIdSync_0400',0, function (done) { - console.log('dataUriUtils attachIdSync start4 '); - var idint = 123456789011; - var result = dataUriUtils.attachId("com.ix.dataUriUtils",idint); - console.log('dataUriUtils attachIdSync URI :' + result) - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/123456789011"); - console.log('dataUriUtils attachIdSync_test start4 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_AttachIdSync_0500 -* @tc.name: Attaches the given ID to the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_AttachIdSync_0500',0, function (done) { - console.log('dataUriUtils attachIdSync start5 '); - var idint = -1; - var result = dataUriUtils.attachId("com.ix.dataUriUtils",idint); - console.log('dataUriUtils attachIdSync URI :' + result) - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/-1"); - console.log('dataUriUtils attachIdSync_test start5 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_DeleteIdSync_0100 -* @tc.name: Deletes the ID from the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_DeleteIdSync_0100',0, function (done) { - console.log('dataUriUtils deleteIdSync start1 '); - var result = dataUriUtils.deleteId("com.ix.dataUriUtils"); - console.log('dataUriUtils deleteIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils"); - console.log('dataUriUtils deleteIdSync_test start1 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_DeleteIdSync_0200 -* @tc.name: Deletes the ID from the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_DeleteIdSync_0200',0, function (done) { - console.log('dataUriUtils deleteIdSync start2 '); - var result = dataUriUtils.deleteId("com.ix.dataUriUtils/1122"); - console.log('dataUriUtils deleteIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils"); - console.log('dataUriUtils deleteIdSync_test start2 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_DeleteIdSync_0300 -* @tc.name: Deletes the ID from the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_DeleteIdSync_0300',0, function (done) { - console.log('dataUriUtils deleteIdSync start3 '); - var result = dataUriUtils.deleteId("com.ix.dataUriUtils1122"); - console.log('dataUriUtils deleteIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils1122"); - console.log('dataUriUtils deleteIdSync_test start3 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_DeleteIdSync_0400 -* @tc.name: Deletes the ID from the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_DeleteIdSync_0400',0, function (done) { - console.log('dataUriUtils deleteIdSync start4 '); - var result = dataUriUtils.deleteId("com.ix.dataUriUtils/-1"); - console.log('dataUriUtils deleteIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils"); - console.log('dataUriUtils deleteIdSync_test start4 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_DeleteIdSync_0500 -* @tc.name: Deletes the ID from the end of the path component of the given URI. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_DeleteIdSync_0500',0, function (done) { - console.log('dataUriUtils deleteIdSync start5 '); - var result = dataUriUtils.deleteId("com.ix.dataUriUtils/1122/2211"); - console.log('dataUriUtils deleteIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/1122"); - console.log('dataUriUtils deleteIdSync_test start5 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_UpdateIdSync_0100 -* @tc.name: Updates the ID in the specified dataUri. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_UpdateIdSync_0100',0, function (done) { - console.log('dataUriUtils updateIdSync start1 '); - var idint = 1122; - var result = dataUriUtils.updateId("com.ix.dataUriUtils",idint); - console.log('updateIdSync updateIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils"); - console.log('dataUriUtils updateIdSync_test start1 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_UpdateIdSync_0200 -* @tc.name: Updates the ID in the specified dataUri. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_UpdateIdSync_0200',0, function (done) { - console.log('dataUriUtils updateIdSync start2 '); - var idint = 1122; - var result = dataUriUtils.updateId("com.ix.dataUriUtils/",idint) - console.log('updateIdSync updateIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/"); - console.log('dataUriUtils updateIdSync_test start2 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_UpdateIdSync_0300 -* @tc.name: Updates the ID in the specified dataUri. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_UpdateIdSync_0300',0, function (done) { - console.log('dataUriUtils updateIdSync start3 '); - var idint = 3344; - var result = dataUriUtils.updateId("com.ix.dataUriUtils/-1",idint) - console.log('updateIdSync updateIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/3344"); - console.log('dataUriUtils updateIdSync_test start3 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_UpdateIdSync_0400 -* @tc.name: Updates the ID in the specified dataUri. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_UpdateIdSync_0400',0, function (done) { - console.log('dataUriUtils updateIdSync start4 '); - var idint = 5566; - var result = dataUriUtils.updateId("com.ix.dataUriUtils/123456789011",idint) - console.log('updateIdSync updateIdSync URI : ' + result); - - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/5566"); - console.log('dataUriUtils updateIdSync_test start4 successful '); - - done(); - }) - -/* -* @tc.number: ACTS_UpdateIdSync_0500 -* @tc.name: Updates the ID in the specified dataUri. -* @tc.desc: Check the return value of the interface -*/ - it('ACTS_UpdateIdSync_0500',0, function (done) { - console.log('dataUriUtils updateIdSync start5 '); - - var idint = 0; - expect(typeof(idint)).assertEqual("number"); - console.log('dataUriUtils updateIdSync start666 '); - - var result = dataUriUtils.updateId("com.ix.dataUriUtils/1122",idint) - console.log('updateIdSync updateIdSync URI : ' + result); - expect(typeof(result)).assertEqual("string"); - expect(result).assertEqual("com.ix.dataUriUtils/0"); - done(); - }) -}) diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/app.json b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/app.json deleted file mode 100644 index 15d65f48a3eebe1e89a1e4f93641f7e0c607da9b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsspecifytesthap", - "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/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/element/string.json deleted file mode 100644 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/Test.json b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 305015644cddbcadf687f91c54386764e7375bdc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,113 +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' -import commonEvent from '@ohos.commonEvent' - -var callBackSeq = ""; - -function publishCallBack() { - console.debug("====>Publish CallBack ====>"); -} - -async function startAbilityProcess(abilityContext, options, parameters) { - let bundleName; - let abilityName; - - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "testA": - bundleName = "com.example.actsspecifytesthap"; - abilityName = "com.example.actsspecifytesthap.MainAbility"; - break; - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters, - }, options, (error, data) => { - console.log('startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) -} - -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - var callBackData = "actsspecifytesthap:" - callBackData += callBackSeq; - - var commonEventPublishData = { - data: callBackData, - parameters: { - displayId: globalThis.abilityWant.parameters['ohos.aafwk.param.displayId'], - windowMode: globalThis.abilityWant.parameters['ohos.aafwk.param.windowMode'], -} - }; - - console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify(abilityWant)); - if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { - commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, () => { - console.log('============>querytestsecond success==========>>') - callBackSeq = ""; - }); - } else { - commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { - callBackSeq = ""; - console.log('============>querytest success==========>>') - startAbilityProcess(globalThis.abilityContext, globalThis.abilityWant.options, abilityWant.parameters); - }); - } -} - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("actsspecifytesthap onCreate") - callBackSeq += "onCreate"; - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("actsspecifytesthap onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("actsspecifytesthap onWindowStageCreate") - // callBackSeq += "onWindowStageCreate"; - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index", null) - console.log("actsspecifytesthap onWindowStageCreate finish") - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("actsspecifytesthap onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("actsspecifytesthap onForeground") - callBackSeq += "onForeground"; - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("actsspecifytesthap onBackground") - } -}; diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json deleted file mode 100644 index 3b88ad073cd61130f3c94e109cff474dd0c1e74d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "module": { - "name": "com.example.actsspecifytesthap", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsspecifytesthap.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" - ] - } - ] - } - ], - "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.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", - "reason": "need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name": "ohos.permission.GET_RUNNING_INFO", - "reason": "need use ohos.permission.GET_RUNNING_INFO" - } - ] - } -} diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/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/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/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/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index 31ee0f53fdaa6f7ba3aa622de0aea4df6f9c7794..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,72 +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 Ability from '@ohos.application.Ability' -import commonEvent from '@ohos.commonEvent' - -async function onShowProcess() { - var abilityWant = globalThis.abilityWant; - - var commonEventPublishData = { - parameters: { - displayId: globalThis.abilityWant.parameters['ohos.aafwk.param.displayId'], - windowMode: globalThis.abilityWant.parameters['ohos.aafwk.param.windowMode'], - } - }; - - console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify(abilityWant)); - - commonEvent.publish("ACTS_TerminateSelf_CommonEvent", commonEventPublishData, () => { - console.log('============>querytestsecond success==========>>') - globalThis.abilityContext.terminateSelf(); - }); - -} -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility2 onCreate") - globalThis.abilityWant = want; - console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant)); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility2 onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/second/second", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("MainAbility onForeground") - onShowProcess(); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100644 index 1f5d8221bf50adbcea94dddb6516cb2823fdcb90..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,56 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' - -export default class ServiceAbility extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - console.log('ServiceAbility registerApplicationStateObserver begin'); - } - - onConnect(want) { - console.log('ServiceAbility onConnect, want:' + want.abilityName); - globalThis.extensionContext = this.context - if (want.action == 'getExtensionInfotwo') { - this.context.startAbility( - { - bundleName: 'com.example.startabilityforresult', - abilityName: 'com.example.startabilityforresult.MainAbility2' - }, - { - windowMode: 2, - displayId: 10, - }).then(() => { - console.log("====>end startAbility====>success!") - }) - console.log('stub SerivceAbilityServer OnConnect start 2'); - } - - } - - onDisconnect(want) { - console.log('ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ServiceAbility onDestroy'); - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index f6803bdae181846c8faa6210088026e705074ce7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,68 +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.ets" -import testsuite from "../../test/List.test.ets" -var testTime = 0; - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - if(testTime++==0){ - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100644 index d76e7f621a4bde7bdf3c9684d82d4a327cb2368e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,323 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -import bundle from '@ohos.bundle' -import missionManager from '@ohos.application.missionManager' -import appManager from '@ohos.application.appManager' - - -var subscriberInfoMultiInstance = { - events: ["MultiInstanceStartNext", "MultiInstanceStartFinish", "TestAppOnForeground"] -}; -const START_ABILITY_TIMEOUT = 5000; -const MAX_MISSION_NUM = 1024; - -async function startAbilityProcess(abilityContext, options, parameters) { - let bundleName; - let abilityName; - - try { - let idx = parameters.nextStep; - switch (parameters.step[idx]) { - case "testA": - bundleName = "com.example.actsspecifytesthap"; - abilityName = "com.example.actsspecifytesthap.MainAbility"; - break; - default: - break; - } - parameters.nextStep = ++idx; - abilityContext.startAbility({ - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters, - }, options, (error, data) => { - console.log('startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - } catch (err) { - console.log('ACTS_getDisplayIdTest_0100 err: ' + err) - } -} - -function getMissionId() { - return new Promise(async (resolve, reject) => { - var missionId = -1; - var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); - for (let i = 0; i < missionInfos.length; i++) { - console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i])) - if ((missionInfos[i].want.abilityName == "com.example.actsgetdisplayidtest.MainAbility") && - (missionInfos[i].runningState == 0)) { - missionId = missionInfos[i].missionId; - break; - } - } - console.log('======>getMissionId resolve missionId<=======' + missionId); - resolve(missionId); - }) -} - -export default function abilityTest(abilityContext) { - describe('ActsGetDisplayIdStartAbilityTest', function () { - - afterEach(async (done) => { - let installer = await bundle.getBundleInstaller(); - var count = 0; - var testMissionId; - - testMissionId = await getMissionId(); - console.log('======>afterEach test missionId<=======' + testMissionId); - await missionManager.moveMissionToFront(testMissionId); - await appManager.killProcessesByBundleName("com.example.actsspecifytesthap"); - done(); - }) - - - /* - * @tc.number: ACTS_StartAbility_0100 - * @tc.name: Get the specified displayId to start Ability - * @tc.desc: Verify Get displayId to start Ability - */ - it('ACTS_StartAbility_0100', 0, async function (done) { - console.log('ACTS_StartAbility_0100====ACTS_StartAbility_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - - async function processInfoCheck(data) { - console.info('====> ACTS_StartAbility_0100=====>'); - expect(data.parameters['displayId']).assertEqual(15); - expect(data.parameters['windowMode']).assertEqual(0); - done(); - } - - if (data.event == "MultiInstanceStartFinish") { - console.info('====> ACTS_StartAbility_0100 start success=====>'); - clearTimeout(id); - processInfoCheck(data); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } else if (data.event == "MultiInstanceStartNext") { - console.log('ACTS_StartAbility_0100 callBackSeq = ' + data.data); - } - } - - commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { - console.debug("====>Create0100 Subscriber====>"); - subscriber = data; - commonEvent.subscribe(subscriber, subscribeCallBack); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe0100 CallBack====>"); - } - - function timeout() { - expect().assertFail(); - console.log('ACTS_StartAbility_0100 timeout'); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.log('Start ACTS_StartAbility_0100 timer id : ' + id); - - startAbilityProcess(abilityContext, { - windowMode: 0, - displayId: 15 - }, { - startId: 0, - stepNum: 1, - nextStep: 0, - step: ["testA"], - }); - }) - - /* - * @tc.number: ACTS_StartAbility_0200 - * @tc.name: Get the specified displayId to start Ability - * @tc.desc: Verify that the ability to start when displayId is a string - */ - it('ACTS_StartAbility_0200', 0, async function (done) { - console.log('ACTS_StartAbility_0200====ACTS_StartAbility_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - - async function processInfoCheck(data) { - console.info('====> ACTS_StartAbility_0200=====>'); - expect(data.parameters['displayId']).assertEqual(0); - expect(data.parameters['windowMode']).assertEqual(0); - done(); - } - - if (data.event == "MultiInstanceStartFinish") { - console.info('====> ACTS_StartAbility_0200 start success=====>'); - clearTimeout(id); - processInfoCheck(data); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } else if (data.event == "MultiInstanceStartNext") { - console.log('ACTS_StartAbility_0200 callBackSeq = ' + data.data); - } - } - - commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { - console.debug("====>Create0200 Subscriber====>"); - subscriber = data; - commonEvent.subscribe(subscriber, subscribeCallBack); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe0200 CallBack====>"); - } - - function timeout() { - expect().assertFail(); - console.log('ACTS_StartAbility_0200 timeout'); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.log('Start ACTS_StartAbility_0200 timer id : ' + id); - - startAbilityProcess(abilityContext, { - windowMode: 0, - displayId: "abc" - }, { - startId: 0, - stepNum: 1, - nextStep: 0, - step: ["testA"] - }); - }) - - /* - * @tc.number: ACTS_StartAbility_0300 - * @tc.name: Get the specified displayId to start Ability - * @tc.desc: Verify that the ability to start when the displayId is undefined - */ - it('ACTS_StartAbility_0300', 0, async function (done) { - console.log('ACTS_StartAbility_0300====ACTS_StartAbility_0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - - async function processInfoCheck(data) { - console.info('====> ACTS_StartAbility_0300=====>'); - expect(data.parameters['displayId']).assertEqual(0); - expect(data.parameters['windowMode']).assertEqual(0); - done(); - } - - if (data.event == "MultiInstanceStartFinish") { - console.info('====> ACTS_StartAbility_0300 start success=====>'); - clearTimeout(id); - processInfoCheck(data); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } else if (data.event == "MultiInstanceStartNext") { - console.log('ACTS_StartAbility_0300 callBackSeq = ' + data.data); - } - } - - commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { - console.debug("====>Create0300 Subscriber====>"); - subscriber = data; - commonEvent.subscribe(subscriber, subscribeCallBack); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe0300 CallBack====>"); - } - - function timeout() { - expect().assertFail(); - console.log('ACTS_StartAbility_0300 timeout'); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.log('Start ACTS_StartAbility_0300 timer id : ' + id); - - startAbilityProcess(abilityContext, { - windowMode: 0, - displayId: undefined - }, { - startId: 0, - stepNum: 1, - nextStep: 0, - step: ["testA"], - }); - }) - - /* - * @tc.number: ACTS_StartAbility_0400 - * @tc.name: Get the specified displayId to start Ability - * @tc.desc: Validation parameters want to filter the DISPLAY_ID of parameters - */ - it('ACTS_StartAbility_0400', 0, async function (done) { - console.log('ACTS_StartAbility_0400====ACTS_StartAbility_0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - - async function processInfoCheck(data) { - console.info('====> ACTS_StartAbility_0400=====>'); - expect(data.parameters['windowMode']).assertEqual(0); - expect(data.parameters['displayId']).assertEqual(0); - done(); - } - - if (data.event == "MultiInstanceStartFinish") { - console.info('====> ACTS_StartAbility_0400 start success=====>'); - clearTimeout(id); - processInfoCheck(data); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - } else if (data.event == "MultiInstanceStartNext") { - console.log('ACTS_StartAbility_0400 callBackSeq = ' + data.data); - } - } - - commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { - console.debug("====>Create0400 Subscriber====>"); - subscriber = data; - commonEvent.subscribe(subscriber, subscribeCallBack); - }) - - function unSubscribeCallback() { - console.debug("====>UnSubscribe0400 CallBack====>"); - } - - function timeout() { - expect().assertFail(); - console.log('ACTS_StartAbility_0400 timeout'); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.log('Start ACTS_StartAbility_0400 timer id : ' + id); - - startAbilityProcess(abilityContext, {}, { - startId: 0, - stepNum: 1, - nextStep: 0, - step: ["testA"], - "ohos.aafwk.param.displayId": 10, - }); - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/config.json b/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/config.json deleted file mode 100755 index 740fdbcf56d489e4458167e1028c8d8b254351b5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/config.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actscontext", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actscontext", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "com.example.permission", - "reason": "$string:permreason_example", - "usedScene": { - "ability": [ - "com.example.Ability", - "com.example.AbilityBackground" - ], - "when": "always" - } - }, - { - "name": "com.example.permission.user", - "reason": "$string:permreason_example", - "usedScene": { - "ability": [ - "com.example.Ability", - "com.example.AbilityBackground" - ], - "when": "always" - } - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": "com.example.actscontext.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/app.js deleted file mode 100755 index 2ba842eda9d2f61221fca73dfb53c2a2903fc3e4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index e973598c2221567553a07b4a3044b86554fd9d81..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - }, - { - "name": "permreason_example", - "value": "permreason example" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/List.test.js deleted file mode 100755 index 98a2fa6e04fa117b773bac708d25cf9e7613bbb1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +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. - */ -require('./ContextJsunit.test.js') diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/config.json b/aafwk/aafwk_standard/context/scene/defpermission/src/main/config.json deleted file mode 100755 index ae380a7bb5683516aea308784e6e1e3e7f743bca..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/scene/defpermission/src/main/config.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "app": { - "bundleName": "com.example.defpermission", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.defpermission", - "name": ".MyApplication", - "defPermissions": [ - { - "name": "com.example.permission", - "grantMode": "system_grant", - "availableScope": [] - }, - { - "name": "com.example.permission.user", - "grantMode": "user_grant", - "availableScope": [] - } - ], - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.defpermission.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/app.js b/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/app.js deleted file mode 100755 index 2ba842eda9d2f61221fca73dfb53c2a2903fc3e4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/resources/base/element/string.json deleted file mode 100755 index d405647b90183b99fb4e15025a9fe12c85c495d4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/test/ApplicationInfoJsunit.test.js b/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/test/ApplicationInfoJsunit.test.js deleted file mode 100644 index 5a932e1eceac1dec829f5d1a7ff56f20ab006b2a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/test/ApplicationInfoJsunit.test.js +++ /dev/null @@ -1,137 +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 commonEvent from '@ohos.commonevent' -import featureAbility from '@ohos.ability.featureability' -import formBindingData from '@ohos.application.formBindingData' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -var getCallingBundleUri = { - events: ['SUB_AA_OpenHarmony_Want_0200_CommonEvent'] -} - -var getCallingBundleType = { - events: ['SUB_AA_OpenHarmony_Want_0300_CommonEvent'] -} - -describe('ApplicationInfoTest', function () { - var TAG = '';- - - /* - * @tc.number SUB_AA_OpenHarmony_FormBase_1000 - * @tc.name Validate formbindingdata creation data - * @tc.desc Function test - * @tc.level 0 - */ - it('SUB_AA_OpenHarmony_FormBase_1000', 0, async function (done) { - console.info('------------start SUB_AA_OpenHarmony_FormBase_1000-------------'); - TAG = 'SUB_AA_OpenHarmony_FormBase_1000'; - var dataObj = { - temperature:"11c", - "time":"11:00", - "test":11, - "test3":true - } - var result = formBindingData.createFormBindingData(dataObj) - console.log(TAG + " result is : " + JSON.stringify(result)) - expect(JSON.stringify(result)). - assertEqual(JSON.stringify({"data":"{\"temperature\":\"11c\",\"time\":\"11:00\",\"test\":11,\"test3\":true}"})); - done(); - console.info('------------end SUB_AA_OpenHarmony_FormBase_1000-------------'); - }); - - /* - * @tc.number SUB_AA_OpenHarmony_Want_0200 - * @tc.name Switching the mission in the launcherlist to the foreground is not supported - * @tc.desc Function test - * @tc.level 0 - */ - it('SUB_AA_OpenHarmony_Want_0200', 0, async function (done) { - console.info('------------start SUB_AA_OpenHarmony_Want_0200-------------'); - TAG = 'SUB_AA_OpenHarmony_Want_0200'; - var Subscriber = ''; - - function SubscribeCallBackUri(err, data) { - console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err)); - expect(data.data == '{true,true,false}').assertTrue(); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); - } - - function UnSubscribeCallback() { - console.debug(TAG + "====>UnSubscribe CallBack====>"); - done(); - } - - commonEvent.createSubscriber(getCallingBundleUri).then(async (data) => { - console.info(TAG + '====>Create Subscriber===='); - Subscriber = data; - console.info(TAG + '====>Create Subscriber====' + JSON.stringify(data) ); - await commonEvent.subscribe(Subscriber, SubscribeCallBackUri); - }); - - featureAbility.startAbility({ - want: { - abilityName: 'com.example.applicationinfo.MainAbility2', - bundleName: 'com.example.applicationinfo', - uri: '{true,true,false}' - } - }, (err, data) => { - console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data)); - }); - console.info('------------end SUB_AA_OpenHarmony_Want_0200-------------'); - }); - - /* - * @tc.number SUB_AA_OpenHarmony_Want_0300 - * @tc.name Switching the mission in the launcherlist to the foreground is not supported - * @tc.desc Function test - * @tc.level 0 - */ - it('SUB_AA_OpenHarmony_Want_0300', 0, async function (done) { - console.info('------------start SUB_AA_OpenHarmony_Want_0300-------------'); - TAG = 'SUB_AA_OpenHarmony_Want_0300'; - var Subscriber = ''; - - function SubscribeCallBackType(err, data) { - console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err)); - expect(data.data == 'MIMETYPE').assertTrue(); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); - } - - function UnSubscribeCallback() { - console.debug(TAG + "====>UnSubscribe CallBack====>"); - done(); - } - - commonEvent.createSubscriber(getCallingBundleType).then(async (data) => { - console.info(TAG + '====>Create Subscriber====>'); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBackType); - }); - - featureAbility.startAbility({ - want: { - abilityName: 'com.example.applicationinfo.MainAbility2', - bundleName: 'com.example.applicationinfo', - type: 'MIMETYPE', - } - }, (err, data) => { - console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data)); - }); - console.info('------------end SUB_AA_OpenHarmony_Want_0300-------------'); - }) -}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/config.json b/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/config.json deleted file mode 100644 index 932f888500827535fc3666b62336a3a67c811b05..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/config.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsfeatureabilitytest", - "vendor": "jstest", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": { - "default": { - "process": "processTest" - } - }, - "module": { - "package": "com.example.actsfeatureabilitytest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "visible": true, - "skills": [ - { - "entities": [ - "entity.system.home", - "flag.home.intent.from.system" - ], - "actions": [ - "action.system.home" - ] - } - ], - "backgroundModes": [ - "dataTransfer" - ], - "name": "com.example.actsfeatureabilitytest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "singleton", - "process": "processTestAbility", - "permissions": ["ohos.permission.ACCELEROMETER"], - "deviceCapability": ["ability_base","ability_runtime"], - "uri": "uriTest", - "visible": true - } - ], - "reqCapabilities": ["reqCapabilitiesTest1","reqCapabilitiesTest2"], - "description": "descriptionTest", - "defPermissions": [ - { - "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.CAMERA", - "reason": "$string:permreason_camera", - "usedScene": - { - "ability": ["com.mycamera.Ability", "com.mycamera.AbilityBackground"], - "when": "always" - } - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" - }, - { - "name": "ohos.permission.ACCELEROMETER", - "reason":"need use ohos.permission.ACCELEROMETER" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 4120936dd63b30d4e147f55414461fcba3dcb0ed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "actsfeatureabilitytest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - }, - { - "name": "permreason_camera", - "value": "permreason camera" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js deleted file mode 100755 index 5683e7aed806aee4f6684ea32db2eda946a5d099..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js +++ /dev/null @@ -1,2158 +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 featureAbility from '@ohos.ability.featureAbility' -import wantconstant from '@ohos.ability.wantConstant' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' -import commonEvent from '@ohos.commonEvent' -import notification from '@ohos.notification'; -import wantAgent from '@ohos.wantAgent'; -import particleAbility from '@ohos.ability.particleAbility' -import backgroundTaskManager from '@ohos.backgroundTaskManager' - -const START_ABILITY_TIMEOUT = 4000; -const TERMINATE_ABILITY_TIMEOUT = 1000; -const TIMEOUT = 1000; -var subscriberInfo_ACTS_StartAbility_0100 = { - events: ["ACTS_StartAbility_0100_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbility_0200 = { - events: ["ACTS_StartAbility_0200_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbility_0300 = { - events: ["ACTS_StartAbility_0300_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbility_0400 = { - events: ["ACTS_StartAbility_0400_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbility_0500 = { - events: ["ACTS_StartAbility_0500_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbility_0600 = { - events: ["ACTS_StartAbility_0600_CommonEvent"], -}; -var subscriberInfoStartAbilityTen = { - events: ["ACTS_StartAbility_1000_CommonEvent"], -}; -var subscriberInfoStartAbilityThirteen = { - events: ["ACTS_StartAbility_1300_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbilityForResult_0100 = { - events: ["ACTS_StartAbilityForResult_0100_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbilityForResult_0200 = { - events: ["ACTS_StartAbilityForResult_0200_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbilityForResult_0300 = { - events: ["ACTS_StartAbilityForResult_0300_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbilityForResult_0400 = { - events: ["ACTS_StartAbilityForResult_0400_CommonEvent"], -}; -var subscriberInfo_ACTS_StartAbilityForResult_0500 = { - events: ["ACTS_StartAbilityForResult_0500_CommonEvent"], -}; -var subscriberInfoStartAbilityForResultSix = { - events: ["ACTS_StartAbilityForResult_0600_CommonEvent"], -}; -var subscriberInfo_ACTS_TerminateAbility_0100 = { - events: ["ACTS_TerminateAbility_0100_CommonEvent", - "ACTS_TerminateAbility_0100_Return"], -}; -var subscriberInfoTerminateAbilityTwo = { - events: ["ACTS_TerminateAbility_0200_CommonEvent", - "ACTS_TerminateAbility_0200_Return"], -}; -var subscriberInfo_ACTS_FinishWithResult_0100 = { - events: ["ACTS_FinishWithResult_0100_CommonEvent"], -}; -var subscriberInfo_ACTS_GetCallingBundle_0100 = { - events: ["ACTS_GetCallingBundle_0100_CommonEvent", - "com.example.actsfeatureabilitytest.promise", - "com.example.actsfeatureabilitytest.callback"], -}; - -describe('ActsFeatureAbilityTest', function () { - - beforeAll(function() { - - /* - * @tc.setup: setup invoked before all testcases - */ - console.info('beforeAll called') - }) - - afterAll(function() { - - /* - * @tc.teardown: teardown invoked after all testcases - */ - console.info('afterAll called') - }) - - beforeEach(function() { - - /* - * @tc.setup: setup invoked before each testcases - */ - console.info('beforeEach called') - }) - - afterEach(function() { - - /* - * @tc.teardown: teardown invoked after each testcases - */ - console.info('afterEach called') - particleAbility.cancelBackgroundRunning(); - setTimeout(() => {}, 500); - backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()); - setTimeout(() => {}, 500); - }) - - /* - * @tc.name:Acts_ContinuousTask_0100 - * @tc.desc:verify new startBackgroundrunning interface promise mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT7U AR000GH6ER AR000GH6EM AR000GH6EN AR000GH6EO - */ - it("Acts_ContinuousTask_0100", 0, async function (done) { - console.log("Acts_ContinuousTask_0100 start"); - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - wantAgent.getWantAgent(wantAgentInfo).then((data) => { - backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then(() => { - console.log("Acts_ContinuousTask_0100 startBackgroundRunning success"); - expect(true).assertTrue(); - setTimeout(() => { - done(); - }, 500); - }).catch((err) => { - expect(false).assertTrue(); - console.log("Acts_ContinuousTask_0100 startBackgroundRunning failure"); - setTimeout(() => { - done(); - }, 500); - }); - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0200 - * @tc.desc:verify new startBackgroundrunning interface callback mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT7T AR000GH6ER AR000GH6EP AR000GJ9PR AR000GH6G8 - */ - it("Acts_ContinuousTask_0200", 0, async function (done) { - console.log("Acts_ContinuousTask_0200 start"); - function conTaskCallback(err, data) { - if (err) { - console.info('Acts_ContinuousTask_0200 startBackgroundRunning failed'); - expect(false).assertTrue(); - } else { - console.info('Acts_ContinuousTask_0200 startBackgroundRunning succeed'); - expect(true).assertTrue(); - } - setTimeout(()=>{ - done(); - }, 500); - } - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - wantAgent.getWantAgent(wantAgentInfo).then((data) => { - backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data, conTaskCallback); - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0300 - * @tc.desc:verify old startBackgroundrunning interface promise mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT7V AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH56K - */ - it("Acts_ContinuousTask_0300", 0, async function (done) { - console.log("Acts_ContinuousTask_0300 start"); - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - wantAgent.getWantAgent(wantAgentInfo).then((data) => { - let basicContent = { - title: "title", - text: "text" - }; - - let notificationContent = { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: basicContent - }; - - let request = { - content: notificationContent, - wantAgent: data - } - - let id = 1; - - particleAbility.startBackgroundRunning(id, request).then((data) => { - console.log("Acts_ContinuousTask_0300 startBackgroundRunning success"); - expect(true).assertTrue(); - setTimeout(() => { - done(); - }, 500); - }).catch((err) => { - expect(false).assertTrue(); - console.log("Acts_ContinuousTask_0300 startBackgroundRunning failure"); - setTimeout(() => { - done(); - }, 500); - }); - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0400 - * @tc.desc:verify old startBackgroundrunning interface callback mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT81 AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH6ET - */ - it("Acts_ContinuousTask_0400", 0, async function (done) { - console.log("Acts_ContinuousTask_0400 start"); - function conTaskCallback(err, data) { - if (err) { - console.info('Acts_ContinuousTask_0400 startBackgroundRunning failure'); - expect(false).assertTrue(); - } else { - console.info('Acts_ContinuousTask_0400 startBackgroundRunning success'); - expect(true).assertTrue(); - } - setTimeout(()=>{ - done(); - }, 500); - } - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - wantAgent.getWantAgent(wantAgentInfo).then((data) => { - let basicContent = { - title: "title", - text: "text" - }; - - let notificationContent = { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: basicContent - }; - - let request = { - content: notificationContent, - wantAgent: data - } - - let id = 1; - - particleAbility.startBackgroundRunning(id, request, conTaskCallback); - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0500 - * @tc.desc:verify new api stopBackgroundrunning interface promise mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT7U AR000GH6ES AR000GH6EM AR000GH6EN AR000GH6EO - */ - it("Acts_ContinuousTask_0500", 0, async function (done) { - console.log("Acts_ContinuousTask_0500 start"); - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - wantAgent.getWantAgent(wantAgentInfo).then((data) => { - backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then((data) => { - backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then((data) => { - console.log("Acts_ContinuousTask_0500 cancelBackgroundRunning success"); - expect(true).assertTrue(); - setTimeout(() => { - done(); - }, 500); - }).catch((err) => { - expect(false).assertTrue(); - console.log("Acts_ContinuousTask_0500 cancelBackgroundRunning failure"); - setTimeout(() => { - done(); - }, 500); - }); - }) - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0600 - * @tc.desc:verify new api stopBackgroundrunning interface callback mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT7T AR000GH6ES AR000GH6EP AR000GJ9PR AR000GH6G8 - */ - it("Acts_ContinuousTask_0600", 0, async function (done) { - console.log("Acts_ContinuousTask_0600 start"); - function conTaskCallback(err, data) { - if (err) { - console.info('Acts_ContinuousTask_0600 startBackgroundRunning failure'); - expect(false).assertTrue(); - } else { - console.info('Acts_ContinuousTask_0600 startBackgroundRunning success'); - expect(true).assertTrue(); - } - setTimeout(()=>{ - done(); - }, 500); - } - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - wantAgent.getWantAgent(wantAgentInfo).then((data) => { - backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then((data) => { - backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext(), conTaskCallback); - }) - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0700 - * @tc.desc:verify old api cancelBackgroundrunning interface promise mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT7V AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH56K - */ - it("Acts_ContinuousTask_0700", 0, async function (done) { - console.log("Acts_ContinuousTask_0700 start"); - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - await wantAgent.getWantAgent(wantAgentInfo).then((data) => { - particleAbility.startBackgroundRunning(data); - setTimeout(()=>{ - }, 500); - }); - - particleAbility.cancelBackgroundRunning().then(() => { - console.log("Acts_ContinuousTask_0700 cancelBackgroundRunning success"); - expect(true).assertTrue(); - setTimeout(() => { - done(); - }, 500); - }).catch( (err) => { - expect(false).assertTrue(); - console.log("Acts_ContinuousTask_0700 cancelBackgroundRunning failure"); - setTimeout(() => { - done(); - }, 500); - }); - }) - - /* - * @tc.name:Acts_ContinuousTask_0800 - * @tc.desc:verify old cancelBackgroundrunning interface callback mode work properly - * @tc.type: FUNC - * @tc.require: SR000GGT81 AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH6ET - */ - it("Acts_ContinuousTask_0800", 0, async function (done) { - console.log("Acts_ContinuousTask_0800 start"); - function conTaskCallback(err, data) { - if (err) { - console.info('Acts_ContinuousTask_0800 startBackgroundRunning failure'); - expect(false).assertTrue(); - } else { - console.info('Acts_ContinuousTask_0800 startBackgroundRunning success'); - expect(true).assertTrue(); - } - setTimeout(()=>{ - done(); - }, 500); - } - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.actsfeatureabilitytest", - abilityName: "com.example.actsfeatureabilitytest.MainAbility" - } - ], - operationType: 2, - requestCode: 0, - wantAgentFlags: [3] - }; - await wantAgent.getWantAgent(wantAgentInfo).then((data) => { - particleAbility.startBackgroundRunning(data); - setTimeout(()=>{ - }, 500); - }); - - particleAbility.cancelBackgroundRunning(conTaskCallback); - }) - - /** - * @tc.number: ACTS_wantConstant_0100 - * @tc.name: wantConstant : Check specific enum - * @tc.desc: Check the return type of the interface (by Promise) - */ - it('ACTS_wantConstant_0100', 0, async function (done) { - expect(wantconstant.Action.ACTION_HOME).assertEqual("ohos.want.action.home"); - expect(wantconstant.Action.ACTION_DIAL).assertEqual("ohos.want.action.dial"); - expect(wantconstant.Action.ACTION_SEARCH).assertEqual("ohos.want.action.search"); - expect(wantconstant.Action.ACTION_WIRELESS_SETTINGS).assertEqual("ohos.settings.wireless"); - expect(wantconstant.Action.ACTION_MANAGE_APPLICATIONS_SETTINGS).assertEqual("ohos.settings.manage.applications"); - expect(wantconstant.Action.ACTION_APPLICATION_DETAILS_SETTINGS).assertEqual("ohos.settings.application.details"); - expect(wantconstant.Action.ACTION_SET_ALARM).assertEqual("ohos.want.action.setAlarm"); - expect(wantconstant.Action.ACTION_SHOW_ALARMS).assertEqual("ohos.want.action.showAlarms"); - expect(wantconstant.Action.ACTION_SNOOZE_ALARM).assertEqual("ohos.want.action.snoozeAlarm"); - expect(wantconstant.Action.ACTION_DISMISS_ALARM).assertEqual("ohos.want.action.dismissAlarm"); - expect(wantconstant.Action.ACTION_DISMISS_TIMER).assertEqual("ohos.want.action.dismissTimer"); - expect(wantconstant.Action.ACTION_SEND_SMS).assertEqual("ohos.want.action.sendSms"); - expect(wantconstant.Action.ACTION_CHOOSE).assertEqual("ohos.want.action.choose"); - expect(wantconstant.Action.ACTION_SELECT).assertEqual("ohos.want.action.select"); - expect(wantconstant.Action.ACTION_SEND_DATA).assertEqual("ohos.want.action.sendData"); - expect(wantconstant.Action.ACTION_SEND_MULTIPLE_DATA).assertEqual("ohos.want.action.sendMultipleData"); - expect(wantconstant.Action.ACTION_SCAN_MEDIA_FILE).assertEqual("ohos.want.action.scanMediaFile"); - expect(wantconstant.Action.ACTION_VIEW_DATA).assertEqual("ohos.want.action.viewData"); - expect(wantconstant.Action.ACTION_EDIT_DATA).assertEqual("ohos.want.action.editData"); - expect(wantconstant.Action.INTENT_PARAMS_INTENT).assertEqual("ability.want.params.INTENT"); - expect(wantconstant.Action.INTENT_PARAMS_TITLE).assertEqual("ability.want.params.TITLE"); - expect(wantconstant.Action.ACTION_FILE_SELECT).assertEqual("ohos.action.fileSelect"); - expect(wantconstant.Action.PARAMS_STREAM).assertEqual("ability.params.stream"); - - expect(wantconstant.Entity.ENTITY_HOME).assertEqual("entity.system.home"); - expect(wantconstant.Entity.ENTITY_DEFAULT).assertEqual("entity.system.default"); - expect(wantconstant.Entity.ENTITY_VOICE).assertEqual("entity.system.voice"); - expect(wantconstant.Entity.ENTITY_BROWSABLE).assertEqual("entity.system.browsable"); - expect(wantconstant.Entity.ENTITY_VIDEO).assertEqual("entity.system.video"); - done(); - }) - - /** - * @tc.number: ACTS_GetContext_0100 - * @tc.name: GetContext : Obtains the Context object - * @tc.desc: Check the return value of the interface (by Promise) - */ - it('ACTS_GetContext_0100', 0, async function (done) { - var promise = await featureAbility.getContext() - expect(typeof (promise)).assertEqual("object"); - done(); - }) - - /** - * @tc.number: ACTS_HasWindowFocus_0100 - * @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus - * @tc.desc: Check the return value of the interface (by Promise) - */ - it('ACTS_HasWindowFocus_0100', 0, async function (done) { - var promise = featureAbility.hasWindowFocus(); - expect(typeof (promise)).assertEqual("object"); - var info = await featureAbility.hasWindowFocus(); - expect(info).assertEqual(true); - done(); - setTimeout(function () { - console.info('====> ACTS_HasWindowFocus_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_HasWindowFocus_0300 - * @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_HasWindowFocus_0300', 0, async function (done) { - var result = featureAbility.hasWindowFocus( - (err, data) => { - console.log("hasWindowFocus asyncCallback code: " + err.code + " data: " + data); - expect(err.code).assertEqual(0); - expect(data).assertTrue(); - done() - } - ); - console.info('AceApplication : hasWindowFocus : ' + result); - setTimeout(function () { - console.info('====> ACTS_HasWindowFocus_0300 =====>') - }, TIMEOUT) - }) - - /* - * @tc.number ACTS_StartAbility_1000 - * @tc.name The configured URI is started and the page is not configured - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1000",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1000-------------------"); - try{ - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_1000_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); - } - - commonEvent.createSubscriber(subscriberInfoStartAbilityTen).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_1000=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - let Want = { - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "xxxxx", - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_1000 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - expect(err.code == 0).assertTrue(); - }); - }catch(error){ - console.log("ACTS_StartAbility_1000 : error = " + error); - } - }) - - /** - * @tc.number: ACTS_StartAbility_0100 - * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. - * @tc.desc: Check the return value of the interface (by Promise) - */ - it('ACTS_StartAbility_0100', 0, async function (done) { - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_0100_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0100).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_0100=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var promise = await featureAbility.startAbility( - { - want: - { - action: "action.system.homeability", - entities: ["entity.system.home"], - type: "MIMETYPE", - options: { - // indicates the grant to perform read operations on the URI - authReadUriPermission: true, - // indicates the grant to perform write operations on the URI - authWriteUriPermission: true, - // support forward intent result to origin ability - abilityForwardResult: true, - // used for marking the ability start-up is triggered by continuation - abilityContinuation: true, - // specifies whether a component does not belong to ohos - notOhosComponent: true, - // specifies whether an ability is started - abilityFormEnabled: true, - // indicates the grant for possible persisting on the URI. - authPersistableUriPermission: true, - // indicates the grant for possible persisting on the URI. - authPrefixUriPermission: true, - // support distributed scheduling system start up multiple devices - abilitySliceMultiDevice: true, - // indicates that an ability using the service template is started regardless of whether the - // host application has been started. - startForegroundAbility: true, - // install the specified ability if it's not installed. - installOnDemand: true, - // return result to origin ability slice - abilitySliceForwardResult: true, - // install the specified ability with background mode if it's not installed. - installWithBackgroundMode: true - }, - deviceId: "", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "" - }, - } - ); - expect(promise).assertEqual(0); - }) - - /** - * @tc.number: ACTS_StartAbility_0200 - * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. - * @tc.desc: Pass the parameters, Check the return value of the interface (by Promise) - */ - it('ACTS_StartAbility_0200', 0, async function (done) { - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_0200_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0200).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_0200=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug('=======wait id======'); - var promise = await featureAbility.startAbility( - { - want: - { - action: "action.system.homeability", - entities: ["entity.system.home"], - type: "MIMETYPE", - options: { - // indicates the grant to perform read operations on the URI - authReadUriPermission: true, - // indicates the grant to perform write operations on the URI - authWriteUriPermission: true, - // support forward intent result to origin ability - abilityForwardResult: true, - // used for marking the ability start-up is triggered by continuation - abilityContinuation: true, - // specifies whether a component does not belong to ohos - notOhosComponent: true, - // specifies whether an ability is started - abilityFormEnabled: true, - // indicates the grant for possible persisting on the URI. - authPersistableUriPermission: true, - // indicates the grant for possible persisting on the URI. - authPrefixUriPermission: true, - // support distributed scheduling system start up multiple devices - abilitySliceMultiDevice: true, - // indicates that an ability using the service template is started regardless of whether the - // host application has been started. - startForegroundAbility: true, - // install the specified ability if it's not installed. - installOnDemand: true, - // return result to origin ability slice - abilitySliceForwardResult: true, - // install the specified ability with background mode if it's not installed. - installWithBackgroundMode: true - }, - deviceId: "", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "", - parameters: - { - mykey0: 1111, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "xxxxxxxxxxxxxxxxxxxxxx", - mykey4: [1, 15], - mykey5: [false, true, false], - mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], - mykey7: true, - }, - }, - } - ); - expect(promise).assertEqual(0); - }) - - /** - * @tc.number: ACTS_StartAbility_0300 - * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. - * @tc.desc: Passing null, Check the return value of the interface (by Promise) - */ - it('ACTS_StartAbility_0300', 0, async function (done) { - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_0300_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0300).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_0300=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var promise = await featureAbility.startAbility( - { - want: - { - action: "", - entities: [""], - type: "", - options: { - // indicates the grant to perform read operations on the URI - authReadUriPermission: true, - // indicates the grant to perform write operations on the URI - authWriteUriPermission: true, - // support forward intent result to origin ability - abilityForwardResult: true, - // used for marking the ability start-up is triggered by continuation - abilityContinuation: true, - // specifies whether a component does not belong to ohos - notOhosComponent: true, - // specifies whether an ability is started - abilityFormEnabled: true, - // indicates the grant for possible persisting on the URI. - authPersistableUriPermission: true, - // indicates the grant for possible persisting on the URI. - authPrefixUriPermission: true, - // support distributed scheduling system start up multiple devices - abilitySliceMultiDevice: true, - // indicates that an ability using the service template is started regardless of whether the - // host application has been started. - startForegroundAbility: true, - // install the specified ability if it's not installed. - installOnDemand: true, - // return result to origin ability slice - abilitySliceForwardResult: true, - // install the specified ability with background mode if it's not installed. - installWithBackgroundMode: true - }, - deviceId: "", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "" - }, - } - ); - expect(promise).assertEqual(0); - }) - - /** - * @tc.number: ACTS_StartAbility_0400 - * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_StartAbility_0400', 0, async function (done) { - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_0400_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0400).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_0400=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var result = featureAbility.startAbility( - { - want: - { - action: "action.system.homeability", - entities: ["entity.system.home"], - type: "MIMETYPE", - options: { - // indicates the grant to perform read operations on the URI - authReadUriPermission: true, - // indicates the grant to perform write operations on the URI - authWriteUriPermission: true, - // support forward intent result to origin ability - abilityForwardResult: true, - // used for marking the ability start-up is triggered by continuation - abilityContinuation: true, - // specifies whether a component does not belong to ohos - notOhosComponent: true, - // specifies whether an ability is started - abilityFormEnabled: true, - // indicates the grant for possible persisting on the URI. - authPersistableUriPermission: true, - // indicates the grant for possible persisting on the URI. - authPrefixUriPermission: true, - // support distributed scheduling system start up multiple devices - abilitySliceMultiDevice: true, - // indicates that an ability using the service template is started regardless of whether the - // host application has been started. - startForegroundAbility: true, - // install the specified ability if it's not installed. - installOnDemand: true, - // return result to origin ability slice - abilitySliceForwardResult: true, - // install the specified ability with background mode if it's not installed. - installWithBackgroundMode: true - }, - deviceId: "", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "" - }, - }, - (error, data) => { - console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) - - }, - ); - }) - - /** - * @tc.number: ACTS_StartAbility_0500 - * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. - * @tc.desc: Pass the parameters, Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_StartAbility_0500', 0, async function (done) { - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_0500_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0500).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_0500=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var result = featureAbility.startAbility( - { - want: - { - action: "action.system.homeability", - entities: ["entity.system.home"], - type: "MIMETYPE", - options: { - // indicates the grant to perform read operations on the URI - authReadUriPermission: true, - // indicates the grant to perform write operations on the URI - authWriteUriPermission: true, - // support forward intent result to origin ability - abilityForwardResult: true, - // used for marking the ability start-up is triggered by continuation - abilityContinuation: true, - // specifies whether a component does not belong to ohos - notOhosComponent: true, - // specifies whether an ability is started - abilityFormEnabled: true, - // indicates the grant for possible persisting on the URI. - authPersistableUriPermission: true, - // indicates the grant for possible persisting on the URI. - authPrefixUriPermission: true, - // support distributed scheduling system start up multiple devices - abilitySliceMultiDevice: true, - // indicates that an ability using the service template is started regardless of whether the - // host application has been started. - startForegroundAbility: true, - // install the specified ability if it's not installed. - installOnDemand: true, - // return result to origin ability slice - abilitySliceForwardResult: true, - // install the specified ability with background mode if it's not installed. - installWithBackgroundMode: true - }, - deviceId: "", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "" - }, - parameters: - { - mykey0: 1111, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "xxxxxxxxxxxxxxxxxxxxxx", - mykey4: [1, 15], - mykey5: [false, true, false], - mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], - mykey7: true, - }, - }, - (error, data) => { - console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) - - }, - ); - }) - - /** - * @tc.number: ACTS_StartAbility_0600 - * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. - * @tc.desc: Passing null, Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_StartAbility_0600', 0, async function (done) { - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_0600_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0600).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_0600=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var result = featureAbility.startAbility( - { - want: - { - action: "", - entities: [""], - type: "", - options: { - // indicates the grant to perform read operations on the URI - authReadUriPermission: true, - // indicates the grant to perform write operations on the URI - authWriteUriPermission: true, - // support forward intent result to origin ability - abilityForwardResult: true, - // used for marking the ability start-up is triggered by continuation - abilityContinuation: true, - // specifies whether a component does not belong to ohos - notOhosComponent: true, - // specifies whether an ability is started - abilityFormEnabled: true, - // indicates the grant for possible persisting on the URI. - authPersistableUriPermission: true, - // indicates the grant for possible persisting on the URI. - authPrefixUriPermission: true, - // support distributed scheduling system start up multiple devices - abilitySliceMultiDevice: true, - // indicates that an ability using the service template is started regardless of whether the - // host application has been started. - startForegroundAbility: true, - // install the specified ability if it's not installed. - installOnDemand: true, - // return result to origin ability slice - abilitySliceForwardResult: true, - // install the specified ability with background mode if it's not installed. - installWithBackgroundMode: true - }, - deviceId: "", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - uri: "" - }, - }, - (error, data) => { - console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) - - }, - ); - }) - - /** - * @tc.number: ACTS_TerminateAbility_0200 - * @tc.name: TerminateAbility : Destroys ability - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_TerminateAbility_0200', 0, async function (done) { - var Subscriber; - let id; - let events = new Map(); - - function SubscribeCallBack(err, data) { - clearTimeout(id); - events.set(data.event, 0); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - if (events.size > 1) { - expect(events.has("ACTS_TerminateAbility_0200_CommonEvent") && - events.has("ACTS_TerminateAbility_0200_Return")).assertTrue(); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } else { - expect(events.has("ACTS_TerminateAbility_0200_CommonEvent") || - events.has("ACTS_TerminateAbility_0200_Return")).assertTrue(); - } - } - - commonEvent.createSubscriber(subscriberInfoTerminateAbilityTwo).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_TerminateAbility_0200=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - console.log('=====start ability====='); - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var promise = featureAbility.startAbility( - { - want: - { - action: "action.system.home", - entities: ["entity.system.home"], - type: "MIMETYPE", - flags: 2, - deviceId: "", - bundleName: "com.example.terminateabilitytest", - abilityName: "com.example.terminateabilitytest.MainAbility", - uri: "" - }, - } - ); - expect(typeof (promise)).assertEqual("object"); - }) - - // checkAbilityName - function checkAbilityName(info) { - console.log("AbilityName name : " + info); - expect(typeof (info)).assertEqual("string"); - expect(info).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); - } - - /** - * @tc.number: ACTS_GetAbilityName_0100 - * @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name. - * @tc.desc: Check the return type of the interface (by Promise) - */ - it('ACTS_GetAbilityName_0100', 0, async function (done) { - var promise = featureAbility.getAbilityName(); - expect(typeof (promise)).assertEqual("object"); - var info = await featureAbility.getAbilityName(); - checkAbilityName(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetAbilityName_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetAbilityName_0200 - * @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name. - * @tc.desc: Check the return type of the interface (by AsyncCallback) - */ - it('ACTS_GetAbilityName_0200', 0, async function (done) { - var result = featureAbility.getAbilityName( - (err, data) => { - checkAbilityName(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetAbilityName_0200 =====>') - }, TIMEOUT) - }) - - // checkApplicationInfo - function checkApplicationInfo(info) { - console.log("getApplicationInfo : " + info) - console.log("name : " + info.name); - console.log("description : " + info.description); - console.log("descriptionId : " + info.descriptionId); - console.log("systemApp : " + info.systemApp); - console.log("enabled : " + info.enabled); - console.log("label : " + info.label); - console.log("labelId : " + info.labelId); - console.log("icon : " + info.icon); - console.log("iconId : " + info.iconId); - console.log("process : " + info.process); - console.log("supportedModes : " + info.supportedModes); - - console.log("moduleSourceDirs length : " + info.moduleSourceDirs.length); - for (var j = 0; j < info.moduleSourceDirs.length; j++) { - console.log("info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]); - } - console.log("permissions length : " + info.permissions.length); - for (var j = 0; j < info.permissions.length; j++) { - console.log("info.permissions[" + j + "] : " + info.permissions[j]); - } - console.log("moduleInfos length : " + info.moduleInfos.length); - for (var j = 0; j < info.moduleInfos.length; j++) { - console.log("info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName); - console.log("info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir); - } - console.log("entryDir : " + info.entryDir); - - expect(typeof (info)).assertEqual("object"); - expect(typeof (info.name)).assertEqual("string"); - expect(typeof (info.description)).assertEqual("string"); - expect(typeof (info.descriptionId)).assertEqual("number"); - expect(typeof (info.systemApp)).assertEqual("boolean"); - expect(typeof (info.enabled)).assertEqual("boolean"); - expect(typeof (info.label)).assertEqual("string"); - expect(typeof (info.labelId)).assertEqual("string"); - expect(typeof (info.icon)).assertEqual("string"); - expect(typeof (info.iconId)).assertEqual("string"); - expect(typeof (info.process)).assertEqual("string"); - expect(typeof (info.supportedModes)).assertEqual("number"); - expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); - expect(Array.isArray(info.permissions)).assertEqual(true); - expect(Array.isArray(info.moduleInfos)).assertEqual(true); - expect(typeof (info.entryDir)).assertEqual("string"); - - expect(info.name).assertEqual("com.example.actsfeatureabilitytest"); - expect(info.description).assertEqual("$string:mainability_description"); - // expect(info.descriptionId).assertEqual(0); //create by DevEco when building HAP. - expect(info.systemApp).assertEqual(true); - expect(info.enabled).assertEqual(true); - expect(info.label).assertEqual("$string:app_name"); - // expect(info.labelId).assertEqual(0); //create by DevEco when building HAP. - expect(info.icon).assertEqual("$media:icon"); - // expect(info.iconId).assertEqual(0); //create by DevEco when building HAP. - expect(info.process).assertEqual("processTest"); - expect(info.supportedModes).assertEqual(0); - expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + - "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); - expect(info.moduleInfos[0].moduleName).assertEqual("entry"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); - expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + - "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); - } - - /** - * @tc.number: ACTS_GetApplicationInfo_0100 - * @tc.name: GetApplicationInfo : Obtains information about the current application. - * @tc.desc: Check the return type of the interface (by Promise) - */ - it('ACTS_GetApplicationInfo_0100', 0, async function (done) { - var context = featureAbility.getContext(); - var promise = context.getApplicationInfo(); - expect(typeof (promise)).assertEqual("object"); - var info = await context.getApplicationInfo(); - checkApplicationInfo(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetApplicationInfo_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetApplicationInfo_0200 - * @tc.name: GetApplicationInfo : Obtains information about the current application. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_GetApplicationInfo_0200', 0, async function (done) { - var context = featureAbility.getContext() - var result = context.getApplicationInfo( - (err, data) => { - checkApplicationInfo(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetApplicationInfo_0200 =====>') - }, TIMEOUT) - }) - - // checkProcessInfo - function checkProcessInfo(info) { - console.log("checkProcessInfo ProcessInfo: " + info); - console.log("checkProcessInfo processName : " + info.processName); - console.log("checkProcessInfo pid : " + info.pid); - - expect(typeof (info)).assertEqual("object"); - expect(typeof (info.processName)).assertEqual("string"); - expect(typeof (info.pid)).assertEqual("number"); - expect(info.processName).assertEqual("processTestAbility"); - } - - /** - * @tc.number: ACTS_GetProcessInfo_0100 - * @tc.name: GetProcessInfo : Called when getting the ProcessInfo - * @tc.desc: Check the return type of the interface (by promise) - */ - it('ACTS_GetProcessInfo_0100', 0, async function (done) { - var context = featureAbility.getContext() - var promise = context.getProcessInfo(); - expect(typeof (promise)).assertEqual("object"); - var info = await context.getProcessInfo(); - checkProcessInfo(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetProcessInfo_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetProcessInfo_0200 - * @tc.name: GetProcessInfo : Called when getting the ProcessInfo - * @tc.desc: Check the return type of the interface (by AsyncCallback) - */ - it('ACTS_GetProcessInfo_0200', 0, async function (done) { - var context = featureAbility.getContext() - var result = context.getProcessInfo( - (err, data) => { - checkProcessInfo(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetProcessInfo_0200 =====>') - }, TIMEOUT) - }) - - // checkElementName - function checkElementName(info) { - console.log("getElementName : " + info); - console.log("deviceId : " + info.deviceId); - console.log("bundleName : " + info.bundleName); - console.log("abilityName : " + info.abilityName); - console.log("uri : " + info.uri); - console.log("shortName : " + info.shortName); - - expect(typeof (info)).assertEqual("object"); - expect(typeof (info.deviceId)).assertEqual("string"); - expect(typeof (info.bundleName)).assertEqual("string"); - expect(typeof (info.abilityName)).assertEqual("string"); - expect(typeof (info.uri)).assertEqual("string"); - expect(typeof (info.shortName)).assertEqual("string"); - - expect(info.deviceId).assertEqual(""); - expect(info.bundleName).assertEqual("com.example.actsfeatureabilitytest"); - expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); - expect(info.uri).assertEqual(""); - expect(info.shortName).assertEqual(""); - } - - /** - * @tc.number: ACTS_GetElementName_0100 - * @tc.name: GetElementName : Obtains the ohos.bundle.ElementName object of the current ability. - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_GetElementName_0100', 0, async function (done) { - var context = featureAbility.getContext() - var promise = context.getElementName(); - expect(typeof (promise)).assertEqual("object"); - var info = await context.getElementName(); - checkElementName(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetElementName_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetElementName_0200 - * @tc.name: GetElementName : Obtains the ohos.bundle.ElementName object of the current ability. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_GetElementName_0200', 0, async function (done) { - var context = featureAbility.getContext() - var result = context.getElementName( - (err, data) => { - checkElementName(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetElementName_0200 =====>') - }, TIMEOUT) - }) - - // checkAppType - function checkAppType(info) { - console.log("AppType : " + info); - expect(typeof (info)).assertEqual("string"); - expect(info).assertEqual("system"); - } - - /** - * @tc.number: ACTS_GetAppType_0100 - * @tc.name: GetAppType : Obtains the type of this application. - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_GetAppType_0100', 0, async function (done) { - var promise = featureAbility.getAppType(); - expect(typeof (promise)).assertEqual("object"); - var info = await featureAbility.getAppType(); - checkAppType(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetAppType_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetAppType_0200 - * @tc.name: GetAppType : Obtains the type of this application. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_GetAppType_0200', 0, async function (done) { - var result = featureAbility.getAppType( - (err, data) => { - checkAppType(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetAppType_0200 =====>') - }, TIMEOUT) - }) - - // checkAbilityInfo - function checkAbilityInfo(data) { - console.log("checkAbilityInfo start " + data); - console.log("checkAbilityInfo bundleName : " + data.bundleName); - console.log("checkAbilityInfo name : " + data.name); - console.log("checkAbilityInfo label : " + data.label); - console.log("checkAbilityInfo description : " + data.description); - console.log("checkAbilityInfo icon : " + data.icon); - console.log("checkAbilityInfo labelId : " + data.labelId); - console.log("checkAbilityInfo descriptionId : " + data.descriptionId); - console.log("checkAbilityInfo iconId : " + data.iconId); - console.log("checkAbilityInfo moduleName : " + data.moduleName); - console.log("checkAbilityInfo process : " + data.process); - console.log("checkAbilityInfo isVisible : " + data.isVisible); - console.log("checkAbilityInfo type : " + data.type) - console.log("checkAbilityInfo orientation : " + data.orientation); - console.log("checkAbilityInfo launchMode : " + data.launchMode); - console.log("checkAbilityInfo uri : " + data.uri); - console.log("checkAbilityInfo promise readPermission : " + data.readPermission); - console.log("checkAbilityInfo writePermission : " + data.writePermission); - console.log("checkAbilityInfo formEntity : " + data.formEntity); - console.log("checkAbilityInfo minFormHeight : " + data.minFormHeight); - console.log("checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); - console.log("checkAbilityInfo minFormWidth : " + data.minFormWidth); - console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); - console.log("checkAbilityInfo targetAbility : " + data.targetAbility); - console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes); - console.log("checkAbilityInfo subType : " + data.subType); - console.log("checkAbilityInfo formEnabled : " + data.formEnabled); - - console.log("checkAbilityInfo permissions length : " + data.permissions.length); - for (var j = 0; j < data.permissions.length; j++) { - console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); - } - console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); - for (var j = 0; j < data.deviceTypes.length; j++) { - console.log("getAbilityInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); - } - console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); - for (var j = 0; j < data.deviceCapabilities.length; j++) { - console.log("getAbilityInfo data.deviceCapabilities[" + j + "] : " + data.deviceCapabilities[j]); - } - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.bundleName)).assertEqual("string"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.process)).assertEqual("string"); - expect(typeof (data.targetAbility)).assertEqual("string"); - expect(typeof (data.backgroundModes)).assertEqual("number"); - expect(typeof (data.isVisible)).assertEqual("boolean"); - expect(typeof (data.formEnabled)).assertEqual("boolean"); - expect(typeof (data.type)).assertEqual("number"); - expect(typeof (data.subType)).assertEqual("number"); - expect(typeof (data.orientation)).assertEqual("number"); - expect(typeof (data.launchMode)).assertEqual("number"); - expect(Array.isArray(data.permissions)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); - expect(typeof (data.readPermission)).assertEqual("string"); - expect(typeof (data.writePermission)).assertEqual("string"); - expect(typeof (data.applicationInfo)).assertEqual("object"); - expect(typeof (data.formEntity)).assertEqual("number"); - expect(typeof (data.minFormHeight)).assertEqual("number"); - expect(typeof (data.defaultFormHeight)).assertEqual("number"); - expect(typeof (data.minFormWidth)).assertEqual("number"); - expect(typeof (data.defaultFormWidth)).assertEqual("number"); - expect(typeof (data.uri)).assertEqual("string"); - - - expect(data.bundleName).assertEqual("com.example.actsfeatureabilitytest"); - expect(data.name).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); - expect(data.label).assertEqual("$string:app_name"); - expect(data.description).assertEqual("$string:mainability_description"); - expect(data.icon).assertEqual("$media:icon"); - - expect(data.moduleName).assertEqual("entry"); - expect(data.process).assertEqual("processTestAbility"); - expect(data.targetAbility).assertEqual(""); - expect(data.backgroundModes).assertEqual(0); - expect(data.isVisible).assertEqual(true); - expect(data.formEnabled).assertEqual(false); - expect(data.type).assertEqual(1); - expect(data.subType).assertEqual(0); - expect(data.orientation).assertEqual(0); - expect(data.launchMode).assertEqual(0); - - expect(data.permissions[0]).assertEqual("ohos.permission.ACCELEROMETER"); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.deviceCapabilities[0]).assertEqual("screen_support"); - expect(data.deviceCapabilities[1]).assertEqual("audio_support"); - - expect(data.readPermission).assertEqual(""); - expect(data.writePermission).assertEqual(""); - expect(data.formEntity).assertEqual(0); - expect(data.minFormHeight).assertEqual(0); - expect(data.defaultFormHeight).assertEqual(0); - expect(data.minFormWidth).assertEqual(0); - expect(data.defaultFormWidth).assertEqual(0); - expect(data.uri).assertEqual("uriTest"); - - console.log("checkAbilityInfo end " + data); - } - - /** - * @tc.number: ACTS_GetAbilityInfo_0100 - * @tc.name: GetAbilityInfo : Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_GetAbilityInfo_0100', 0, async function (done) { - var promise = featureAbility.getAbilityInfo(); - expect(typeof (promise)).assertEqual("object"); - - var info = await featureAbility.getAbilityInfo(); - checkAbilityInfo(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetAbilityInfo_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetAbilityInfo_0200 - * @tc.name: GetAbilityInfo : Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_GetAbilityInfo_0200', 0, async function (done) { - var result = featureAbility.getAbilityInfo( - (err, data) => { - checkAbilityInfo(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetAbilityInfo_0200 =====>') - }, TIMEOUT) - }) - - // checkHapModuleInfo - function checkHapModuleInfo(data) { - console.log("checkHapModuleInfo start " + data); - console.log("checkHapModuleInfo name : " + data.name); - console.log("checkHapModuleInfo description : " + data.description); - console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); - console.log("checkHapModuleInfo icon : " + data.icon); - console.log("checkHapModuleInfo label : " + data.label); - console.log("checkHapModuleInfo labelId : " + data.labelId); - console.log("checkHapModuleInfo iconId : " + data.iconId); - console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg); - console.log("checkHapModuleInfo supportedModes : " + data.supportedModes); - console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); - for (var j = 0; j < data.reqCapabilities.length; j++) { - console.log("getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); - } - console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); - for (var j = 0; j < data.deviceTypes.length; j++) { - console.log("getHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); - } - console.log("checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length); - console.log("checkHapModuleInfo moduleName : " + data.moduleName); - console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); - console.log("checkHapModuleInfo installationFree : " + data.installationFree); - - expect(typeof (data)).assertEqual("object"); - expect(typeof (data.name)).assertEqual("string"); - expect(typeof (data.description)).assertEqual("string"); - expect(typeof (data.descriptionId)).assertEqual("number"); - expect(typeof (data.icon)).assertEqual("string"); - expect(typeof (data.label)).assertEqual("string"); - expect(typeof (data.labelId)).assertEqual("number"); - expect(typeof (data.iconId)).assertEqual("number"); - expect(typeof (data.backgroundImg)).assertEqual("string"); - expect(typeof (data.supportedModes)).assertEqual("number"); - expect(Array.isArray(data.reqCapabilities)).assertEqual(true); - expect(Array.isArray(data.deviceTypes)).assertEqual(true); - expect(Array.isArray(data.abilityInfos)).assertEqual(true); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.mainAbilityName)).assertEqual("string"); - expect(typeof (data.installationFree)).assertEqual("boolean"); - - expect(data.name).assertEqual("com.example.actsfeatureabilitytest"); - expect(data.description).assertEqual("descriptionTest"); - expect(data.descriptionId).assertEqual(0); - expect(data.icon).assertEqual("$media:icon"); - expect(data.label).assertEqual("$string:app_name"); - expect(data.labelId).assertEqual(0); - expect(data.iconId).assertEqual(0); - expect(data.backgroundImg).assertEqual(""); - expect(data.supportedModes).assertEqual(0); - - expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); - expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); - expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.moduleName).assertEqual("entry") - expect(data.mainAbilityName).assertEqual(""); - expect(data.installationFree).assertEqual(false); - - console.log("checkHapModuleInfo end " + data); - } - - /** - * @tc.number: ACTS_GetHapModuleInfo_0100 - * @tc.name: GetHapModuleInfo : Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_GetHapModuleInfo_0100', 0, async function (done) { - var promise = featureAbility.getHapModuleInfo(); - expect(typeof (promise)).assertEqual("object"); - var info = await featureAbility.getHapModuleInfo(); - checkHapModuleInfo(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetHapModuleInfo_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetHapModuleInfo_0200 - * @tc.name: GetHapModuleInfo : Obtains the HapModuleInfo object of the application. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_GetHapModuleInfo_0200', 0, async function (done) { - var result = featureAbility.getHapModuleInfo( - (err, data) => { - checkHapModuleInfo(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetHapModuleInfo_0200 =====>') - }, TIMEOUT) - }) - - // checkProcessName - function checkProcessName(info) { - console.log("checkProcessName processName : " + info); - expect(typeof (info)).assertEqual("string"); - expect(info).assertEqual("processTestAbility"); - } - - /** - * @tc.number: ACTS_GetProcessName_0100 - * @tc.name: GetProcessName : Obtains the name of the current process. - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_GetProcessName_0100', 0, async function (done) { - var context = featureAbility.getContext(); - var promise = context.getProcessName(); - expect(typeof (promise)).assertEqual("object"); - var info = await context.getProcessName(); - checkProcessName(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetProcessName_0100 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetProcessName_0200 - * @tc.name: GetProcessName : Obtains the name of the current process. - * @tc.desc: Check the return value of the interface (by AsyncCallback) - */ - it('ACTS_GetProcessName_0200', 0, async function (done) { - var context = featureAbility.getContext(); - var result = context.getProcessName( - (err, data) => { - checkProcessName(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetProcessName_0200 =====>') - }, TIMEOUT) - }) - - /** - * @tc.number: ACTS_GetCallingBundle_0100 - * @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability. - * @tc.desc: Check the return type of the interface (by AsyncCallback) - */ - it('ACTS_GetCallingBundle_0100', 0, async function (done) { - var Subscriber; - let id; - let events = new Map(); - - function SubscribeCallBack(err, data) { - clearTimeout(id); - events.set(data.event, 0) - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - if (events.size == 1) { - expect(events.has("ACTS_GetCallingBundle_0100_CommonEvent") || - events.has("com.example.actsfeatureabilitytest.promise") || - events.has("com.example.actsfeatureabilitytest.callback")).assertTrue(); - } else if (events.size == 2) { - expect(events.has("com.example.actsfeatureabilitytest.promise") || - events.has("com.example.actsfeatureabilitytest.callback")).assertTrue(); - } else if (events.size == 3) { - expect(events.has("ACTS_GetCallingBundle_0100_CommonEvent") && - events.has("com.example.actsfeatureabilitytest.promise") && - events.has("com.example.actsfeatureabilitytest.callback")).assertTrue(); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - } - - commonEvent.createSubscriber(subscriberInfo_ACTS_GetCallingBundle_0100).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_GetCallingBundle_0100=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - var result = await featureAbility.startAbility( - { - want: - { - bundleName: "com.example.getcallingbundlepromisetest", - abilityName: "com.example.getcallingbundlepromisetest.MainAbility", - }, - } - ); - }) - - // checkGetOrCreateLocalDir - function checkGetOrCreateLocalDir(info) { - console.log("checkGetOrCreateLocalDir root dir : " + info); - expect(typeof (info)).assertEqual("string"); - } - - // @tc.number: ACTS_GetOrCreateLocalDir_0100 - // @tc.name: GetProcessName : Obtains the name of the current process. - // @tc.desc: Check the return value of the interface (by promise) - it('ACTS_GetOrCreateLocalDir_0100', 0, async function (done) { - var context = featureAbility.getContext(); - var promise = context.getOrCreateLocalDir(); - expect(typeof (promise)).assertEqual("object"); - var info = await context.getOrCreateLocalDir(); - checkGetOrCreateLocalDir(info); - done(); - setTimeout(function () { - console.info('====> ACTS_GetOrCreateLocalDir_0100 =====>') - }, TIMEOUT) - }) - - // @tc.number: ACTS_GetOrCreateLocalDir_0200 - // @tc.name: GetProcessName : Obtains the name of the current process. - // @tc.desc: Check the return value of the interface (by AsyncCallback) - it('ACTS_GetOrCreateLocalDir_0200', 0, async function (done) { - var context = featureAbility.getContext(); - var result = context.getOrCreateLocalDir( - (err, data) => { - checkGetOrCreateLocalDir(data); - done() - } - ); - setTimeout(function () { - console.info('====> ACTS_GetOrCreateLocalDir_0200 =====>') - }, TIMEOUT) - }) - - /* - * @tc.number ACTS_StartAbility_0700 - * @tc.name Configures the wrong abilityname validation - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_0700",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_0700-------------------"); - try{ - let Want = { - deviceId: '', - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbilityXXXXX", - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_0700 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - expect(err.code == 2097152).assertTrue(); - done(); - }); - }catch(error){ - console.log("ACTS_StartAbility_0700 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_0800 - * @tc.name Misconfigured bundlename validation - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_0800",0, async function(done){ - console.info("------------------logMessage startAbilityTest_0300-------------------"); - try{ - let Want = { - deviceId: '', - bundleName: "com.example.startabilityxxxxx", - abilityName: "com.example.startability.MainAbility", - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_0800 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - expect(err.code != 0).assertTrue(); - done(); - }); - }catch(error){ - console.log("ACTS_StartAbility_0800 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_0900 - * @tc.name Misconfigured deviceid validation - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_0900",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_0900-------------------"); - try{ - let Want = { - deviceId: "43026cb4ca40ce10101834d72731dc8509be1906d30e8d42e86886d2791e82xx", - bundleName: "com.example.startability", - abilityName: "com.example.startability.MainAbility", - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_0900 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data) + "err.code: " + err.code); - expect(err.code != 0).assertTrue(); - done(); - }); - }catch(error){ - console.log("ACTS_StartAbility_0900 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_1100 - * @tc.name Verify the ability of implicitly starting through action without configuring action - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1100",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1100-------------------"); - try{ - let Want = { - action: "action.sysxxxtem.homexxxx" - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_1100 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - expect(err.code != 0).assertTrue(); - done(); - }); - }catch(error){ - console.log("ACTS_StartAbility_1100 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_1200 - * @tc.name Verify that the ability without configured entities is started through action and entities - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1200",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1200-------------------"); - try{ - let Want = { - action: "action.system.home", - entities: ["entity.system.homexxxxxxxxx"] - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_1200 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - expect(err.code != 0).assertTrue(); - done(); - }); - }catch(error){ - console.log("ACTS_StartAbility_1200 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_1300 - * @tc.name Start ability through action and entities. Entities is configured as an empty array - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1300",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1300-------------------"); - try{ - var Subscriber; - let id; - - function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_StartAbility_1300_CommonEvent"); - console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); - } - - commonEvent.createSubscriber(subscriberInfoStartAbilityThirteen).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribe CallBack====>"); - done(); - } - - function timeout() { - expect().assertFail(); - console.debug('ACTS_StartAbility_1300=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - let Want = { - action: "action.system.homeability", - entities: [] - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_1300 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - expect(err.code == 0).assertTrue(); - }); - }catch(error){ - console.log("ACTS_StartAbility_1300 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_1400 - * @tc.name Start ability through action and entities, which are configured as strings - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1400",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1400-------------------"); - try{ - let Want = { - action: "action.system.home", - entities: 'asdfghj' - } - var StartAbilityParameter = { - want:Want - } - - featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ - console.log('ACTS_StartAbility_1400 asyncCallback errCode : ' + JSON.stringify(err) - + " data: " + JSON.stringify(data)); - done(); - }); - }catch(error){ - console.log("ACTS_StartAbility_1400 : error = " + error); - } - }); - - /* - * @tc.number ACTS_StartAbility_1600 - * @tc.name Startability input parameter want is {} - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1600",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1600-------------------"); - let Want = {} - var StartAbilityParameter = { - want:Want - } - - var promise = featureAbility.startAbility(StartAbilityParameter); - if (promise) { - promise.then((data) => { - console.log('ACTS_StartAbility_1600 errCode : ' + " data: " + JSON.stringify(data)); - expect().assertFail(); - done(); - }).catch((err)=>{ - expect(err.code != 0).assertTrue(); - done(); - }); - } else { - expect(promise == undefined).assertTrue(); - done(); - } - }); - - /* - * @tc.number ACTS_StartAbility_1700 - * @tc.name The startability input parameter is not configured with want - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1700",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1700-------------------"); - var StartAbilityParameter = {} - var promise = featureAbility.startAbility(StartAbilityParameter) - if (promise) { - promise.then((data) => { - console.log('ACTS_StartAbility_1700 data: ' + JSON.stringify(data)); - expect().assertFail(); - done(); - }).catch((err)=>{ - expect(err.code != 0).assertTrue(); - done(); - }); - } else { - expect(promise == undefined).assertTrue(); - done(); - } - }); - - /* - * @tc.number ACTS_StartAbility_1800 - * @tc.name The startability input parameter is undefined - * @tc.desc Function test - * @tc.level 0 - */ - it("ACTS_StartAbility_1800",0, async function(done){ - console.info("------------------logMessage ACTS_StartAbility_1800-------------------"); - var promise = featureAbility.startAbility(undefined); - if (promise) { - promise.then((data) => { - console.log('ACTS_StartAbility_1800 asyncCallback data: ' + JSON.stringify(data)); - expect().assertFail(); - done(); - }).catch((err)=>{ - expect(err.code != 0).assertTrue(); - done(); - }); - } else { - expect(promise == undefined).assertTrue(); - done(); - } - }); -}) diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js deleted file mode 100644 index a9e636da7768f961c62594c2f13aec8e9ef63746..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,16 +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. - */ -require('./FeatureAbilityJsunit.test.js') -require('./StartAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/element/string.json deleted file mode 100644 index 1724af07388fce024e85278e38d4aa3c3a0c7158..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "finishwithresultemptytest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/element/string.json deleted file mode 100644 index 57065ef21c6e46fbd44b9656208bd4291373b2dc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "finishwithresultpromiseparameterstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/element/string.json deleted file mode 100644 index d4822ce6c37488a67e5e0adc948d50eb928cbe44..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "finishwithresulttest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/element/string.json deleted file mode 100644 index f16bfd0d1c357ba07feced220004e608dd74f80c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "getcallingbundletest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/resources/base/element/string.json deleted file mode 100644 index dd684230ed29a563b9847de98018335d1b5e01e3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "startability" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/element/string.json deleted file mode 100644 index 48717037bdb04147fecbae5e0017ac4023e2d36d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "startabilityforresult" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/app.js deleted file mode 100755 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/app.js +++ /dev/null @@ -1,22 +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. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/element/string.json deleted file mode 100644 index 269e9af645789b37955965a903693e200c611e49..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "terminateabilitytest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/BUILD.gn deleted file mode 100644 index 0885418aa1099cbfe6d7bae58bd907bcc43adf68..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/BUILD.gn +++ /dev/null @@ -1,70 +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") - -group("formmanager") { - testonly = true - if (is_standard_system) { - deps = [ - "formhostst_ets/formsystemhost:FormSystemHost", - "formhostst_ets/formsystemhostb:FormSystemHostB", - "formhostst_ets/formsystemhostc:FormSystemHostC", - "formhostst_ets/formsystemhostd:FormSystemHostD", - "formhostst_ets/formsystemhoste:FormSystemHostE", - "formhostst_ets/formsystemhostf:FormSystemHostF", - "formhostst_ets/formsystemhostg:FormSystemHostG", - "formhostst_ets/formsystemhosti:FormSystemHostI", - "formhostst_ets/formsystemhostj:FormSystemHostJ", - "formhostst_ets/formsystemhostk:FormSystemHostK", - "formhostst_ets/formsystemhostl:FormSystemHostL", - "formhostst_ets/formsystemhostn:FormSystemHostN", - "formhostst_ets/formsystemhostnoperm:FormSystemHostNoPerm", - "formhostst_ets/formsystemhosto:FormSystemHostO", - "formhostst_ets/formsystemhostp:FormSystemHostP", - "formproviderst_ets/formsupplyapplicationA:FormSupplyAppA", - "formproviderst_ets/formsupplyapplicationB:FormSupplyAppB", - "formproviderst_ets/formsupplyapplicationC:FormSupplyAppC", - "formproviderst_ets/formsupplyapplicationD:FormSupplyAppD", - "formproviderst_ets/formsupplyapplicationE:FormSupplyAppE", - "formproviderst_ets/formsupplyapplicationF:FormSupplyAppF", - "formproviderst_ets/formsupplyapplicationG:FormSupplyAppG", - "formproviderst_ets/formsupplyapplicationH:FormSupplyAppH", - "formproviderst_ets/formsupplyapplicationNotSysApp:FormSupplyAppNS", - "formproviderst_ets/formsystemprovidera:FormSystemProviderA", - "formproviderst_ets/formsystemproviderb:FormSystemProviderB", - "formproviderst_ets/formsystemproviderc:FormSystemProviderC", - "formproviderst_ets/formsystemproviderd:FormSystemProviderD", - "formsystemtest_ets/formacquiretest:FormAcquireTest", - "formsystemtest_ets/formacquiretest2:FormAcquireTest2", - "formsystemtest_ets/formdeletetest:FormDeleteTest", - "formsystemtest_ets/formdynamicrefreshtest:FormDynamicRefreshTest", - "formsystemtest_ets/formfuzztest:ActsFormFuzzTest", - "formsystemtest_ets/formgetformsinfotest/formsoneandonetest:FormsOneAndOneTest", - "formsystemtest_ets/formgetformsinfotest/formsoneandtwotest:FormsOneAndTwoTest", - "formsystemtest_ets/formgetformsinfotest/formsoneandzerotest:FormsOneAndZeroTest", - "formsystemtest_ets/formgetformsinfotest/formswithoutpermtest:FormsWithoutPermTest", - "formsystemtest_ets/formgetformsinfotest/formszerotest:FormsZeroTest", - "formsystemtest_ets/formhostdeathrecipienttest:FormHostDeathRecipientTest", - "formsystemtest_ets/formperformancetest:FormPerformanceTest", - "formsystemtest_ets/formreleasetest:FormReleaseTest", - "formsystemtest_ets/formstatetest_disable:FormStateDisableTest", - "formsystemtest_ets/formstatetest_enable:FormStateEnableTest", - "formsystemtest_ets/formstatetest_notifyinvisible:FormStateNotifyInvisibleTest", - "formsystemtest_ets/formstatetest_notifyinvisible2:FormStateNotifyInvisibleTest2", - "formsystemtest_ets/formstatetest_notifyvisible:FormStateNotifyVisibleTest", - "formsystemtest_ets/formstresstest:FormStressTest", - "formsystemtest_ets/formupdatefreshtest:FormUpdateRefreshTest", - ] - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 178d3f1f3e9a63e1ae8fe06792bfef738a5805f2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,304 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private deleteForm = false; - private deleteId = "-1"; - private temporaryId = "-1"; - private temporary = false; - private castForm = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formOnUninstallEvent = "FMS_FormOnUninstall_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formCastEvent Publish CallBack ====>"); - } - - private publishOnUninstallCallBack() { - console.debug("====>formOnUninstallEvent Publish CallBack ====>"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); - if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhost deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - console.log("formsystemhost dimension1:" + this.dimension); - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - console.log("formsystemhost dimension2:" + this.dimension); - if (want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if (want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if (want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if (want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:' + this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end' + JSON.stringify(want)); - - if (!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhost deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhost deleteForm result:' + data); - let commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.log("formsystemhost deleteForm end"); - } - if (!want.parameters.isCreate && this.castForm) { - console.log("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.log("[FormComponent.host] castTempForm end"); - } - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if (this.castForm) { - console.log("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.formId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.log("[FormComponent.host] castTempForm end"); - } else if (this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if (this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - let commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - - console.log("[FormComponent.host] deleteForm end"); - }, 1000); - } else { - let commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onUninstall((info) => { - console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - let commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId": info.id.toString() - } - }; - commonEvent.publish(this.formOnUninstallEvent, commonEventPublishData, this.publishOnUninstallCallBack); - }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if (this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId": this.formId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 02459b19d0916cf6ae988712c167d2160976e0ca..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,261 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private deleteForm = false; - private deleteId = "-1"; - private temporaryId="-1"; - private temporary = false; - private castForm = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - private subscriberDle; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formCastEvent Publish CallBack ====>"); - } - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); - if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostb") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhost deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDle = data; - await commonEvent.subscribe(this.subscriberDle, this.deleteCallBack); - }) - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if(want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if(want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if(want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if(!this.dimension) { - this.dimension = FormDimension.Dimension_1_2; - } - if(want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if(want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if(want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if(want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end'+ JSON.stringify(want)); - - if(!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhostb deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhostb deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - - console.log("formsystemhostb deleteForm end"); - } - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if(this.castForm) { - console.log("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - - console.log("[FormComponent.host] castTempForm end"); - } else if(this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if(this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.log("[FormComponent.host] deleteForm end"); - }, 1000); - } else { - let commonEventPublishData = { - data: this.formId.toString() - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - // .onUninstall((info) => { - // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - // }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if(this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/BUILD.gn deleted file mode 100644 index d9128314a02104ff6a2018c1d60ab69d38384cf4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostC") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostC" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json deleted file mode 100644 index ce18d9ac81a49cb0bce009638cd024f35ca4edcd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostc", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostc", - "name": ".FormStHostAppC", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_TimeChange_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormCast_commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "name": "FMS_TimeChange_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/element/string.json deleted file mode 100644 index c09b6a139bf6b26a7d5447935d0727c7bebcd524..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostC" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index f511c9847045d37b78a4efb559b798f544e0135e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,333 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private releaseForm = false; - private releaseId = "-1"; - private deleteForm = false; - private deleteId = "-1"; - private temporaryId="-1"; - private temporary = false; - private castForm = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); - } - private publishOnDeletedCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); - } - private publishOnReleasedCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formsystemhostc formCastEventCallBack ====>"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); - if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostd") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhost deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if(want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if(want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if(want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if(!this.dimension) { - this.dimension = FormDimension.Dimension_1_2; - } - if(want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if(want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if(want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if(want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - if(want.parameters.releaseForm) { - this.releaseForm = want.parameters.releaseForm; - } - if(want.parameters.releaseId) { - this.releaseId = want.parameters.releaseId; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end'+ JSON.stringify(want)); - - if(!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhost deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhost deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('formsystemhost deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("formsystemhost deleteForm end"); - } - - if(!want.parameters.isCreate && this.releaseForm) { - console.log("formsystemhost releaseForm start"); - formManager.releaseForm(this.releaseId) - .then((data) => { - console.info('formsystemhost releaseForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }) - .catch((error) => { - console.info('formsystemhost releaseForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }); - - console.log("formsystemhost releaseForm end"); - } - - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if(this.castForm) { - console.log("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.log("[FormComponent.host] castTempForm end"); - } else if(this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if(this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - var commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('formsystemhost deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("[FormComponent.host] deleteForm end"); - }, 1000); - } else if(this.releaseForm) { - console.log("[FormComponent.host] releaseForm start"); - if(this.releaseId == "self") { - this.releaseId = this.formId.toString(); - } - setTimeout(() => { - formManager.releaseForm(this.releaseId) - .then((data) => { - console.info('[FormComponent] releaseForm result:' + data); - let retData = "-1"; - if(data == 0) { - retData = data.toString(); - } - var commonEventPublishData = { - data: retData, - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }); - - console.log("[FormComponent.host] releaseForm end"); - }, 1000); - } else { - var commonEventPublishData = { - data: this.formId.toString() - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - // .onUninstall((info) => { - // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - // }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if(this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 4471833c674de2e02777f7f828c95b6e4fbcfad1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,416 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from '@ohos.ability.featureAbility'; -import formManager from '@ohos.application.formHost'; -import formProvider from '@ohos.application.formProvider'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private requestForm = false; - private requestId = "-1"; - private refreshForm = false; - private refreshId = "-1"; - private refreshTime = 5; - private notifyVisibleForms = false; - private notifyVisibleId = "-1"; - private deleteForm = false; - private deleteId = "-1"; - private temporaryId = "-1"; - private temporary = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private formOnDynamicRefreshEvent = "FMS_FormDynamicRefresh_commonEvent"; - private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); - } - private publishOnDeletedCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); - } - private formOnDynamicRefreshCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc formOnDynamicRefreshEventk ====>"); - } - private formOnRequestCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc formOnRequestCallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); - if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhost deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if (!this.dimension) { - this.dimension = FormDimension.Dimension_1_2; - } - if (want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if (want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if (want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - if (want.parameters.refreshForm) { - this.refreshForm = want.parameters.refreshForm; - } - if (want.parameters.refreshId) { - this.refreshId = want.parameters.refreshId; - } - if (want.parameters.refreshTime) { - this.refreshTime = want.parameters.refreshTime; - } - if (want.parameters.requestForm) { - this.requestForm = want.parameters.requestForm; - } - if (want.parameters.requestId) { - this.requestId = want.parameters.requestId; - } - if (want.parameters.notifyVisibleForms) { - this.notifyVisibleForms = want.parameters.notifyVisibleForms; - } - if (want.parameters.notifyVisibleId) { - this.notifyVisibleId = want.parameters.notifyVisibleId; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:' + this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end' + JSON.stringify(want)); - - if (!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhost deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhost deleteForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('formsystemhost deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("formsystemhost deleteForm end"); - } - if (!want.parameters.isCreate && this.refreshForm) { - console.log("formsystemhost refreshForm start"); - formProvider.setFormNextRefreshTime(this.refreshId, this.refreshTime) - .then((data) => { - console.info('formsystemhost refreshForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId": this.refreshId.toString() - } - }; - commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); - }) - .catch((error) => { - console.info('formsystemhost refreshForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.refreshId.toString() - } - }; - commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); - }); - - console.log("formsystemhost deleteForm end"); - } - if (!want.parameters.isCreate && this.requestForm) { - console.log("[FormComponent.host] requestForm start"); - formManager.requestForm(this.requestId) - .then((data) => { - console.info('[FormComponent] requestForm result:' + data); - var commonEventPublishData = { - data: "0", - parameters: { - "formId": this.requestId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); - }) - .catch((error) => { - console.info('[FormComponent] requestForm error:' + error.toString()); - var commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.requestId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); - }); - - console.log("[FormComponent.host] requestForm end"); - } - - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if (this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if (this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - var commonEventPublishData = { - data: "0", - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('formsystemhost deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("[FormComponent.host] deleteForm end"); - }, 1000); - } else if (this.requestForm) { - console.log("[FormComponent.host] requestForm start"); - if (this.requestId == "self") { - this.requestId = this.formId.toString(); - } - setTimeout(() => { - formManager.requestForm(this.requestId) - .then((data) => { - console.info('[FormComponent] requestForm result:' + data); - var delFormId = this.requestId; - if (this.requestId == "0" || this.requestId == "-1") { - delFormId = this.formId.toString(); - } - var commonEventPublishData = { - data: "0", - parameters: { - "formId": delFormId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); - }) - .catch((error) => { - console.info('[FormComponent] requestForm error:' + error); - var delFormId = this.requestId; - if (this.requestId == "0" || this.requestId == "-1") { - delFormId = this.formId.toString(); - } - var commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": delFormId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); - }); - - console.log("[FormComponent.host] requestForm end"); - }, 1000); - } else if (this.refreshForm) { - console.log("formsystemhost refreshForm start"); - if (this.refreshId == "self") { - this.refreshId = this.formId.toString(); - } - setTimeout(() => { - formProvider.setFormNextRefreshTime(this.refreshId, this.refreshTime) - .then((data) => { - console.info('formsystemhost refreshForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId": this.refreshId.toString() - } - }; - commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); - }) - .catch((error) => { - console.info('formsystemhost refreshForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.refreshId.toString() - } - }; - commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); - }); - }, 1000); - } else if (this.notifyVisibleForms) { - console.log("formsystemhost notifyVisibleForms start"); - if (this.notifyVisibleId == "self") { - this.notifyVisibleId = this.formId.toString(); - } - setTimeout(() => { - formManager.notifyVisibleForms([this.notifyVisibleId]) - .then((data) => { - console.info('formsystemhost notifyVisibleForms result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId": this.notifyVisibleId.toString() - } - }; - }) - .catch((error) => { - console.info('formsystemhost notifyVisibleForms error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.notifyVisibleId.toString() - } - }; - }); - }, 1000); - } else { - var commonEventPublishData = { - data: this.formId.toString() - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onUninstall((info) => { - console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if (this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId": this.formId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/BUILD.gn deleted file mode 100644 index e8de20fcdc7fc8bd480b936628eaeb50d2c8649c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostF") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostF" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json deleted file mode 100644 index c732ef25756ee0f6c5b6fd0ec2d28e2e2d9bf454..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostf", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostf", - "name": ".FormStHostAppF", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormUpdateRefresh_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "name": "FMS_FormUpdateRefresh_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 02404deccbe974f4bfdd4d55d40299755fc3308b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,427 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from '@ohos.ability.featureAbility'; -import formBindingData from '@ohos.application.formBindingData'; -import formManager from '@ohos.application.formHost'; -import formProvider from '@ohos.application.formProvider'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private updateForm = false; - private updateId = "-1"; - private jsonEmpty = false; - private releaseForm = false; - private releaseId = "-1"; - private deleteForm = false; - private deleteId = "-1"; - private temporaryId="-1"; - private temporary = false; - - private isStartOtherApp = false; - private otherAppState = "visible"; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; - private formOnUpdatedEvent = "FMS_FormUpdateRefresh_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); - } - private publishOnDeletedCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); - } - private publishOnReleasedCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); - } - private publishOnUpdatedCallBack() { - this.canCreateForm = false; - console.debug("====>formsystemhostc publishOnUpdatedCallBack ====>"); - } - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); - if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostf") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhost deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if(want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if(want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if(want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if(!this.dimension) { - this.dimension = FormDimension.Dimension_1_2; - } - if(want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if(want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if(want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - if(want.parameters.releaseForm) { - this.releaseForm = want.parameters.releaseForm; - } - if(want.parameters.releaseId) { - this.releaseId = want.parameters.releaseId; - } - if(want.parameters.updateForm) { - this.updateForm = want.parameters.updateForm; - } - if(want.parameters.updateId) { - this.updateId = want.parameters.updateId; - } - if(want.parameters.jsonEmpty) { - this.jsonEmpty = want.parameters.jsonEmpty; - } - if(want.parameters.isStartOtherApp) { - this.isStartOtherApp = true; - if(want.parameters.otherAppState) { - this.otherAppState = want.parameters.otherAppState; - } - } - - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end'+ JSON.stringify(want)); - - if(!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhost deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhost deleteForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('formsystemhost deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("formsystemhost deleteForm end"); - } - - if(!want.parameters.isCreate && this.releaseForm) { - console.log("formsystemhost releaseForm start"); - formManager.releaseForm(this.releaseId) - .then((data) => { - console.info('formsystemhost releaseForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }) - .catch((error) => { - console.info('formsystemhost releaseForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }); - - console.log("formsystemhost releaseForm end"); - } - - if(!want.parameters.isCreate && this.updateForm) { - console.log("formsystemhost updateForm start"); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - count: 10 - }; - if(this.jsonEmpty) { - formData = {}; - } - let bindingData = formBindingData.createFormBindingData(formData); - formProvider.updateForm(this.updateId, bindingData) - .then((data) => { - console.info('formsystemhost updateForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.updateId - } - }; - commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); - }) - .catch((error) => { - console.info('formsystemhost updateForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.updateId - } - }; - commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); - }); - - console.log("formsystemhost releaseForm end"); - } - - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if(this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if(this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - var commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('formsystemhost deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - console.log("[FormComponent.host] deleteForm end"); - }, 500); - } else if(this.releaseForm) { - console.log("[FormComponent.host] releaseForm start"); - if(this.releaseId == "self") { - this.releaseId = this.formId.toString(); - } - setTimeout(() => { - formManager.releaseForm(this.releaseId) - .then((data) => { - console.info('[FormComponent] releaseForm result:' + data); - var commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }) - .catch((error) => { - console.info('formsystemhost releaseForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); - }); - - console.log("[FormComponent.host] releaseForm end"); - }, 500); - } else if (this.updateForm) { - console.log("formsystemhost updateForm start"); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - count: 10 - }; - if(this.jsonEmpty) { - formData = {}; - } - let bindingData = formBindingData.createFormBindingData(formData); - formProvider.updateForm(this.updateId, bindingData) - .then((data) => { - console.info('formsystemhost updateForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.updateId - } - }; - commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); - }) - .catch((error) => { - console.info('formsystemhost updateForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.updateId - } - }; - commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); - }); - - console.log("formsystemhost releaseForm end"); - } else if (this.isStartOtherApp) { - console.log("formsystemhost app G start"); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : this.otherAppState, - "stateIds" : [this.formId.toString()], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`formsystemhost featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`formsystemhost featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - } else { - var commonEventPublishData = { - data: this.formId.toString() - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - // .onUninstall((info) => { - // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - // }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if(this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/element/string.json deleted file mode 100644 index c882f827ab1f381a56251b150bc55eb6c3f082f2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostF" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/BUILD.gn deleted file mode 100644 index a4cec6e6f4b2c9d988ca269ca7191867267d2c2b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostG") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostG" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json deleted file mode 100644 index 4b94f73261b48e6528c78aedf2598cffd0e71b60..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostg", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostg", - "name": ".FormStHostAppG", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 411f282e3147ba3adc7b7ab24f181dd82cb7da0c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,502 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private stateForm = "visible"; - private doStateForm = false; - private stateIds = []; - private deleteForm = false; - private deleteId = "-1"; - private temporaryId="-1"; - private temporary = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private formOnStateEvent = "FMS_FormOnState_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>[FormComponent.host] formOnErrorEventCallBack ====>"); - } - private publishOnDeletedCallBack() { - this.canCreateForm = false; - console.debug("====>[FormComponent.host] publishOnDeletedCallBack ====>"); - } - private publishOnStateCallBack() { - this.canCreateForm = false; - console.debug("====>[FormComponent.host] publishOnStateCallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>[FormComponent.host] formOnAcquiredEventCallBack ====>"); - } - private deleteCallBack(err, data) { - console.info("!!!====>[FormComponent.host] deleteCallBack start:====>" + JSON.stringify(data)); - if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostg") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>[FormComponent.host] deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>[FormComponent.host] Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if(want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if(want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if(want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if(!this.dimension) { - this.dimension = FormDimension.Dimension_1_2; - } - if(want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if(want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if(want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - if(want.parameters.stateForm) { - this.stateForm = want.parameters.stateForm; - this.doStateForm = true; - } - if(want.parameters.stateIds) { - this.stateIds = want.parameters.stateIds; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end'+ JSON.stringify(want)); - - if(!want.parameters.isCreate && this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent.host] deleteForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.deleteId; - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId; - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("[FormComponent.host] deleteForm end"); - } - - if(!want.parameters.isCreate && this.stateForm) { - if(this.stateForm == "visible") { - console.log("[FormComponent.host] notifyVisibleForm start"); - formManager.notifyVisibleForms(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] notifyVisibleForm result:' + data); - console.info('[FormComponent.host] notifyVisibleForm formId:' + this.stateIds[0]); - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "visible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] notifyVisibleForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "visible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] notifyVisibleForm end"); - } else if(this.stateForm == "invisible") { - console.log("[FormComponent.host] notifyInvisibleForm start"); - formManager.notifyInvisibleForms(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] notifyInvisibleForm result:' + data); - console.info('[FormComponent.host] notifyInvisibleForm formId:' + this.stateIds[0]); - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "invisible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] notifyInvisibleForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "invisible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] notifyInvisibleForm end"); - } else if(this.stateForm == "enable") { - console.log("[FormComponent.host] enableFormsUpdate start"); - formManager.enableFormsUpdate(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] enableFormsUpdate result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "enable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] enableFormsUpdate error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "enable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] enableFormsUpdate end"); - } else { - console.log("[FormComponent.host] disableFormsUpdate start"); - formManager.disableFormsUpdate(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] disableFormsUpdate result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "disable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] disableFormsUpdate error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "disable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] disableFormsUpdate end"); - } - } - - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if(this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if(this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - let commonEventPublishData = { - data: "0", - parameters: { - "formId" : this.deleteId; - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - }); - - console.log("[FormComponent.host] deleteForm end"); - }, 500); - } else if(this.doStateForm) { - console.log("[FormComponent.host] state start"); - if((this.stateIds.length != 0) && (this.stateIds[0] == "self")) { - this.stateIds = [this.formId.toString()]; - } - console.info('[FormComponent.host] notifyVisibleForm stateIds:' + this.stateIds); - setTimeout(() => { - if(this.stateForm == "visible") { - console.log("[FormComponent.host] notifyVisibleForm start"); - formManager.notifyVisibleForms(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] notifyVisibleForm result:' + data); - console.info('[FormComponent.host] notifyVisibleForm formId:' + this.stateIds[0]); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "visible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] notifyVisibleForm error:' + error); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "visible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] notifyVisibleForm end"); - } else if(this.stateForm == "invisible") { - console.log("[FormComponent.host] notifyInvisibleForm start"); - formManager.notifyInvisibleForms(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] notifyInvisibleForm result:' + data); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - console.info('[FormComponent.host] notifyInvisibleForm formId:' + this.stateIds[0]); - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "invisible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] notifyInvisibleForm error:' + error.code); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "invisible", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] notifyInvisibleForm end"); - } else if(this.stateForm == "enable") { - console.log("[FormComponent.host] enableFormsUpdate start"); - formManager.enableFormsUpdate(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] enableFormsUpdate result:' + data); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "enable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] enableFormsUpdate error:' + error); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "enable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] enableFormsUpdate end"); - } else { - console.log("[FormComponent.host] disableFormsUpdate start"); - formManager.disableFormsUpdate(this.stateIds) - .then((data) => { - console.info('[FormComponent.host] disableFormsUpdate result:' + data); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: "0", - parameters: { - "kind": "disable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }) - .catch((error) => { - console.info('[FormComponent.host] disableFormsUpdate error:' + error); - if(this.stateIds.length == 0) { - this.stateIds = ["-1"]; - } - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "kind": "disable", - "formId" : this.stateIds[0] - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); - }); - console.log("[FormComponent.host] disableFormsUpdate end"); - } - }, 1000); - } else { - let commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onUninstall((info) => { - console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if(this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); - } else { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId" : "-1" - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 6599b743b4595d9466e1e01cd86af8be538c06b4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostG" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 14318ae2da62da2ec4af8f00fec1f06c937fbe3e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,290 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - private deleteForm = false; - private deleteId = "-1"; - private temporaryId = "-1"; - private temporary = false; - private castForm = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.info("====>formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.info("====>formOnAcquiredEvent Publish CallBack ====>"); - } - private publishCastCallBack() { - console.info("====>formCastEvent Publish CallBack ====>"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); - if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhost deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if (want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if (want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if (want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:' + this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end' + JSON.stringify(want)); - - if (!want.parameters.isCreate && this.deleteForm) { - console.info("formsystemhost deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhost deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.info("formsystemhost deleteForm end"); - } - if (!want.parameters.isCreate && this.castForm) { - console.info("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId": this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.info("[FormComponent.host] castTempForm end"); - } - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.info(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if (this.castForm) { - console.info("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId": this.formId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.info("[FormComponent.host] castTempForm end"); - } else if (this.deleteForm) { - console.info("[FormComponent.host] deleteForm start"); - if (this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - - console.info("[FormComponent.host] deleteForm end"); - }, 1000); - } else { - let commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId": this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onUninstall((info) => { - console.info("[FormComponent] onUninstall:" + JSON.stringify(info)); - }) - .onError((error) => { - console.info("[FormComponent.host] error code:" + error.errcode); - console.info("[FormComponent.host] error msg:" + error.msg); - if (this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId": this.formId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index bd7874c1aca816921c9bd2681d4fd1d0ee60ce49..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,290 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private deleteForm = false; - private deleteId = "-1"; - private temporaryId="-1"; - private temporary = false; - private castForm = false; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private publishOnErrorCallBack() { - this.canCreateForm = false; - console.debug("====>formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formCastEvent Publish CallBack ====>"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>formsystemhostj deleteCallBack start:====>" + JSON.stringify(data)); - if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostj") { - return; - } - formManager.deleteForm(data.data) - .then((data2) => { - console.info('[FormComponent] deleteForm result:' + data2); - }); - - this.canCreateForm = false; - console.info("!!!====>formsystemhostj deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>formsystemhostj Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); - }) - - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - this.moduleName = want.parameters.moduleName; - if(want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - console.log("formsystemhostj dimension1:" + this.dimension); - if(want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - console.log("formsystemhostj dimension2:" + this.dimension); - if(want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if(want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if(want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if(want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end'+ JSON.stringify(want)); - - if(!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhostj deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhostj deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.log("formsystemhostj deleteForm end"); - } - if(!want.parameters.isCreate && this.castForm) { - console.log("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.log("[FormComponent.host] castTempForm end"); - } - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.log("[FormComponent.host] get form, form id:" + form.id); - this.formId = form.id; - if(this.castForm) { - console.log("[FormComponent.host] castTempForm start"); - formManager.castTempForm(this.temporaryId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - setTimeout(() => { - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error); - setTimeout(() => { - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.temporaryId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }, 5); - }); - console.log("[FormComponent.host] castTempForm end"); - } else if(this.deleteForm) { - console.log("[FormComponent.host] deleteForm start"); - if(this.deleteId == "self") { - this.deleteId = this.formId.toString(); - } - setTimeout(() => { - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('[FormComponent] deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .catch((error) => { - console.info('[FormComponent] deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - - console.log("[FormComponent.host] deleteForm end"); - }, 1000); - } else { - let commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - // .onUninstall((info) => { - // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); - // }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - if(this.deleteForm && this.deleteId) { - let commonEventPublishData = { - data: error.msg, - parameters: { - "formId" : this.formId.toString() - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } else { - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - } - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/BUILD.gn deleted file mode 100644 index b08ce13e9cc8ca80025bec20e695a30a1f4e6df9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostK") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostK" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json deleted file mode 100644 index 8cb2ede4c0acb655005dab91e03c1869249f50ed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostk", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostk", - "name": ".FormStHostAppK", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormTerminate_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnReleased_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormOnCast_commonEvent" - }, - { - "name": "FMS_FormTerminate_commonEvent" - }, - { - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - }, - { - "name": "fms.time_speed" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 5c749e5e14fa212fc0679e169bf53f16e85f20c6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.hostk] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.hostk] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 2331e063d6fb28ed6c2b66e3b32046a2332c7895..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,609 +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 featureAbility from '@ohos.ability.featureAbility'; -import formHost from '@ohos.application.formHost'; -import commonEvent from '@ohos.commonEvent'; -import { getCurrentTime } from '@ohos.systemTime'; - -// @ts-nocheck -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = `com.form.formsystemtestservicea.hmservice`; - @State ability: string = `com.form.formsystemtestservicea.hmservice.MainAbility`; - @State moduleName: string = `entry`; - @State name: string = `Form_Js001`; - @State canCreateForm: boolean = false; - @State allowUpdate: boolean = true; - @State isShowing: boolean = true; - @State dimension: FormDimension = FormDimension.Dimension_1_2; - @State temporary: boolean = false; - private requestForm = false; - private requestId = `-1`; - private temporaryId = `-1`; - private deleteForm = false; - private deleteId = `-1`; - private castTempForm = false; - private notifyVisibility = false; - private notifyVisibleForms = false; - private notifyInvisibleForms = false; - private releaseForm = false; - private releaseId = "-1"; - private update = false; - private enableUpdate = false; - private disableUpdate = false; - private isVisible = false; - private castForm = false; - private tempFormId = 0; - private createTempAndNormal = false; - private tempParam = {}; - private createSecondForm = false; - private secondParam = {}; - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"] - }; - private subscriberFormTerminateEvent = { - events: ["FMS_FormTerminate_commonEvent"] - }; - private TAG = `[FormComponent.hostk]`; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; - - private onAcquiredCallback() { - console.info(`${this.TAG} onAcquiredCallback`); - } - - private onRequestCallback() { - console.info(`====>${this.TAG} onRequestCallback====>`); - } - - private onDeletedCallback() { - console.info(`${this.TAG} onDeletedCallback`); - } - - private onReleasedCallback() { - console.info(`====>${this.TAG} onReleasedCallback====>`); - } - - private unsubscribeDeleteCallback() { - console.info(`${this.TAG} unSubscribeDeleteCallback`); - } - - async private aboutToAppear() { - const onDeleteEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormDeleteEvent); - const onTerminateEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormTerminateEvent); - commonEvent.subscribe(onDeleteEventSubscriber, async (err, data) => { - const formIds = data.parameters.formIds; - console.info(`${this.TAG} deleteCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${this.TAG} deleteCallback formIds: ${JSON.stringify(formIds)}`); - - commonEvent.unsubscribe(onDeleteEventSubscriber, () => this.unsubscribeDeleteCallback()); - let deletedFormAmount = 0; - if (formIds.length == 0) { - return; - } - formIds.forEach(async (formId, index) => { - try { - const res = await formHost.deleteForm(formId); - ++deletedFormAmount; - console.info(`${this.TAG} deleteForm${index} result: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${this.TAG} deleteForm${index} error: ${JSON.stringify(error)}`); - } - - if (index >= formIds.length - 1) { - const commonEventPublishData = { - parameters: { - deletedFormAmount: deletedFormAmount, - formIds: [].concat(data.parameters.formIds) - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, () => this.onDeletedCallback()); - console.info(`${this.TAG} deleteCallback end, deletedFormAmount ${deletedFormAmount}`); - } - }); - }); - - featureAbility.getWant() - .then(async (want: any) => { - console.info(`${this.TAG} ===> getWant: ${JSON.stringify(want)}`); - this.formId = want.parameters.formId; - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if (want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if (want.parameters.temporaryId) { - this.temporaryId = want.parameters.temporaryId; - } - if (want.parameters.requestForm) { - this.requestForm = want.parameters.requestForm; - } - if (want.parameters.requestId) { - this.requestId = want.parameters.requestId; - } - if (want.parameters.createSecondForm) { - this.createSecondForm = want.parameters.createSecondForm; - this.secondParam = want.parameters.secondParam; - } - if (want.parameters.createTempAndNormal) { - this.createTempAndNormal = want.parameters.createTempAndNormal; - this.tempParam = want.parameters.tempParam; - } - if (want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if (want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - if (want.parameters.castTempForm) { - this.castTempForm = want.parameters.castTempForm; - } - if (want.parameters.notifyVisibility) { - this.notifyVisibility = want.parameters.notifyVisibility; - } - if (want.parameters.notifyVisibleForms) { - this.notifyVisibleForms = want.parameters.notifyVisibleForms; - } - if (want.parameters.notifyInvisibleForms) { - this.notifyInvisibleForms = want.parameters.notifyInvisibleForms; - } - if (want.parameters.releaseForm) { - this.releaseForm = want.parameters.releaseForm; - } - if (want.parameters.releaseId) { - this.releaseId = want.parameters.releaseId; - } - if (want.parameters.update) { - this.update = want.parameters.update; - } - if (want.parameters.enableUpdate) { - this.enableUpdate = want.parameters.enableUpdate; - } - if (want.parameters.disableUpdate) { - this.disableUpdate = want.parameters.disableUpdate; - } - if (want.parameters.subscribeTerminate) { - commonEvent.subscribe(onTerminateEventSubscriber, async (err, data) => { - console.info(`${this.TAG} onTerminateCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - commonEvent.unsubscribe(onTerminateEventSubscriber, () => { }); - console.info(`${this.TAG} onTerminateCallback end`); - setTimeout(async () => { - // terminate self - featureAbility.terminateSelf(); - console.info(`${this.TAG} featureAbility.terminateSelf`); - }, 1000); - }); - } - if (want.parameters.isCreate) { - this.canCreateForm = want.parameters.isCreate; - } - - if (!want.parameters.isCreate && this.deleteForm) { - console.log(`${this.TAG} deleteForm start`); - formHost.deleteForm(this.deleteId) - .then((data) => { - console.info(`${this.TAG} deleteForm result: ${JSON.stringify(data)}`); - let commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.deleteId - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.onDeletedCallback); - }) - .catch((error) => { - console.info(`${this.TAG} deleteForm error: ${JSON.stringify(error)}`); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.deleteId - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.onDeletedCallback); - }); - } - - if (!want.parameters.isCreate && this.releaseForm) { - console.log(`${this.TAG} releaseForm start`); - formHost.releaseForm(this.releaseId, true) - .then((data) => { - console.info(`${this.TAG} releaseForm result: ${JSON.stringify(data)}`); - let commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.releaseId - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.onReleasedCallback); - }) - .catch((error) => { - console.info(`${this.TAG} releaseForm error: ${JSON.stringify(error)}`); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId": this.releaseId - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.onReleasedCallback); - }); - } - - if (!this.canCreateForm && this.requestForm) { - let commonEventPublishData; - formHost.requestForm(this.requestId) - .then((data) => { - console.info(`${this.TAG} requestForm result: ${JSON.stringify(data)}`); - commonEventPublishData = { - data: data || `0`, - parameters: { - "formId": this.requestId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); - }) - .catch((error) => { - console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`); - commonEventPublishData = { - parameters: { - "error": error - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); - }); - } - }) - .catch((error: any) => { - console.error(`${this.TAG} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Column() { - Text(`form component test begin`) - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpdate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired(async (form) => { - const createdTime = await getCurrentTime(); - this.formId = form.id; - console.info(`${this.TAG} get form, form id: ${form.id}`); - if (this.deleteForm) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.deleteForm(this.formId); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} deleteForm result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `deleteForm`, - formId: this.formId, - startTime: startTime, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.formOnAcquiredEvent()); - } catch (error) { - console.info(`${this.TAG} deleteForm error: ${JSON.stringify(error)}`); - } - } else if (this.castTempForm) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.castTempForm(this.formId); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} castTempForm result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `castTempForm`, - formId: this.formId, - startTime: startTime, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.formOnAcquiredEvent()); - } catch (error) { - console.info(`${this.TAG} castTempForm error: ${JSON.stringify(error)}`); - } - } else if (this.notifyVisibility) { - try { - const res = await formHost.notifyVisibleForms([this.formId]); - console.info(`${this.TAG} notifyVisibleForms result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `notifyVisibleForms`, - formId: this.formId, - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.formOnAcquiredEvent()); - } catch (error) { - console.info(`${this.TAG} notifyVisibleForms error: ${JSON.stringify(error)}`); - } - try { - const res = await formHost.notifyInvisibleForms([this.formId]); - console.info(`${this.TAG} notifyInvisibleForms result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `notifyInvisibleForms`, - formId: this.formId, - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.formOnAcquiredEvent()); - } catch (error) { - console.info(`${this.TAG} notifyInvisibleForms error: ${JSON.stringify(error)}`); - } - } else if (this.notifyVisibleForms) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.notifyVisibleForms([this.formId]); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} notifyVisibleForms result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `notifyVisibleForms`, - formId: this.formId, - startTime: startTime, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.formOnAcquiredEvent()); - } catch (error) { - console.info(`${this.TAG} notifyVisibleForms error: ${JSON.stringify(error)}`); - } - } else if (this.notifyInvisibleForms) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.notifyInvisibleForms([this.formId]); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} notifyInvisibleForms result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `notifyInvisibleForms`, - formId: this.formId, - startTime: startTime, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.formOnAcquiredEvent()); - } catch (error) { - console.info(`${this.TAG} notifyInvisibleForms error: ${JSON.stringify(error)}`); - } - } else if (this.requestForm) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.requestForm(this.formId); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} requestForm result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `request`, - formId: this.formId, - startTime: startTime, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } catch (error) { - console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`); - } - } else if (this.releaseForm) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.releaseForm(this.formId); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} releaseForm result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `release`, - formId: this.formId, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } catch (error) { - console.info(`${this.TAG} releaseForm error: ${JSON.stringify(error)}`); - } - } else if (this.update) { - try { - const res = await formHost.enableFormsUpdate([this.formId]); - console.info(`${this.TAG} enableUpdate result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `enableUpdate`, - formId: this.formId, - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } catch (error) { - console.info(`${this.TAG} enableUpdate error: ${JSON.stringify(error)}`); - } - try { - const res = await formHost.disableFormsUpdate([this.formId]); - console.info(`${this.TAG} disableUpdate result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `disableUpdate`, - formId: this.formId, - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } catch (error) { - console.info(`${this.TAG} disableUpdate error: ${JSON.stringify(error)}`); - } - } else if (this.enableUpdate) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.enableFormsUpdate([this.formId]); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} enableUpdate result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `enableUpdate`, - formId: this.formId, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } catch (error) { - console.info(`${this.TAG} enableUpdate error: ${JSON.stringify(error)}`); - } - } else if (this.disableUpdate) { - try { - const startTime = await getCurrentTime(); - const res = await formHost.disableFormsUpdate([this.formId]); - const endTime = await getCurrentTime(); - console.info(`${this.TAG} disableUpdate result: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: res || `0`, - parameters: { - kind: `disableUpdate`, - formId: this.formId, - hostTime: endTime - startTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } catch (error) { - console.info(`${this.TAG} disableUpdate error: ${JSON.stringify(error)}`); - } - } else { - const commonEventPublishData = { - data: this.formId.toString(), - parameters: { - formId: this.formId.toString(), - time: createdTime - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - } - }) - .onUninstall((info) => { - console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); - const commonEventPublishData = { - parameters: { - formId: info.id.toString(), - kind: "onUninstall" - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - }) - .onError((error) => { - console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); - }) - } - if (this.createSecondForm) { - FormComponent({ - id: this.secondParam.formId, - name: this.secondParam.name, - bundle: this.secondParam.bundle, - ability: this.secondParam.ability, - module: this.secondParam.moduleName, - dimension: FormDimension.Dimension_1_2, - temporary: this.secondParam.temporary, - }) - .allowUpdate(this.allowUpdate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(`${this.TAG} secondForm onAcquired, form id: ${form.id}`); - this.formId = form.id; - const commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId": this.formId.toString() - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - }) - .onUninstall((info) => { - console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); - }) - .onError((error) => { - console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); - }); - } - if (this.createTempAndNormal) { - FormComponent({ - id: this.tempParam.formId, - name: this.tempParam.name, - bundle: this.tempParam.bundle, - ability: this.tempParam.ability, - module: this.tempParam.moduleName, - dimension: FormDimension.Dimension_1_2, - temporary: true, - }) - .allowUpdate(this.allowUpdate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(`${this.TAG} castForm onAcquired, form id: ${form.id}`); - this.formId = form.id; - const commonEventPublishData = { - data: this.formId.toString(), - parameters: { - "formId": this.formId.toString(), - "cast": true, - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); - }) - .onUninstall((info) => { - console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); - }) - .onError((error) => { - console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); - }); - } - } - .backgroundColor(Color.White) - - Text(`form component test end`); - } - .backgroundColor(Color.White) - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 3243229f530e22599745231c6d8590cf8b97d528..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostK" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/BUILD.gn deleted file mode 100644 index 5855a48590a0d1ea2d675d0e25b04aad3eaa090a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostL") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostL" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json deleted file mode 100644 index aee14662e91db4cd3b0399b33d4adf4180ef5237..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostl", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostl", - "name": ".FormStHostAppL", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnRequest_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 7ce0bb2eb23400d7855759a4ace8997f67787570..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.hostl] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.hostl] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 707008c2b7d41740cab53cd179e49b25b372a844..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,166 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from '@ohos.ability.featureAbility'; -import formManager from '@ohos.application.formHost'; - -// @ts-nocheck -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = `com.form.formsystemtestservicea.hmservice`; - @State ability: string = `com.form.formsystemtestservicea.hmservice.MainAbility`; - @State moduleName: string = `entry`; - @State name: string = `Form_Js001`; - @State canCreateForm: boolean = false; - @State allowUpdate: boolean = true; - @State isShowing: boolean = true; - @State dimension: FormDimension = FormDimension.Dimension_1_2; - @State temporary: boolean = false; - private requestForm = false; - private requestId = `-1`; - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"] - }; - private TAG = `[FormComponent.hostl]`; - private formOnAcquiredEvent = `FMS_FormOnAcquired_commonEvent`; - private formOnRequestEvent = `FMS_FormOnRequest_commonEvent`; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - - private onAcquiredCallback() { - console.info(`====>${this.TAG} onAcquiredCallback====>`); - } - - private onRequestCallback() { - console.info(`====>${this.TAG} onRequestCallback====>`); - } - - private unsubscribeDeleteCallback() { - console.info(`${this.TAG} unSubscribeDeleteCallback====>`); - } - - async private aboutToAppear() { - const onDeleteEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormDeleteEvent); - commonEvent.subscribe(onDeleteEventSubscriber, async (err, data) => { - console.info(`${this.TAG} deleteCallBack start:====> ${JSON.stringify(data)}`); - - data.parameters.formIds.forEach(async (formId) => { - await formHost.deleteForm(formId) - .then((res) => { - console.info(`${this.TAG} deleteForm result: ${JSON.stringify(res)}`); - }); - }); - - commonEvent.unsubscribe(onDeleteEventSubscriber, () => this.unsubscribeDeleteCallback()); - console.info(`${this.TAG} deleteCallBack end ====>`); - }); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.TAG} getWant: ${JSON.stringify(want)}`); - this.formId = want.parameters.formId; - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if (want.parameters.requestForm) { - this.requestForm = want.parameters.requestForm; - } - if (want.parameters.requestId) { - this.requestId = want.parameters.requestId; - } - if (want.parameters.isCreate) { - this.canCreateForm = want.parameters.isCreate; - } - - if (!this.canCreateForm && this.requestForm) { - let commonEventPublishData; - formManager.requestForm(this.requestId) - .then((data) => { - console.info(`${this.TAG} requestForm result: ${JSON.stringify(data)}`); - commonEventPublishData = { - data: data.toString(), - parameters: { - "formId": this.requestId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); - }) - .catch((error) => { - console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`); - commonEventPublishData = { - parameters: { - "error": error - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); - }); - } - }) - .catch((error: any) => { - console.error(`${this.TAG} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Column() { - Text(`form component test begin`); - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpdate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(`${this.TAG} onAcquired, form id: ${form.id}`); - this.formId = form.id; - const commonEventPublishData = { - data: this.formId.toString() - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.onAcquiredCallback); - }) - .onUninstall((info) => { - console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); - }) - .onError((error) => { - console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); - }); - } - } - .backgroundColor(Color.White) - - Text(`form component test end`); - } - .backgroundColor(Color.White) - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 3c68884fd781d546997ac57f9ac72f9be57d618d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostL" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/BUILD.gn deleted file mode 100644 index fcf084568f352b8efec14a5602fd987a28d5866e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostN") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostN" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json deleted file mode 100644 index bba04f58c33a6dcdcffec741a932da4cebdb5744..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostn", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostn", - "name": ".FormStHostAppN", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_SendCastForm_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormCast_commonEvent" - }, - { - "name": "FMS_SendCastForm_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index e4e8562fc92d4bacb97b41c514aefe3cc255846e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,455 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State optType: number = 0; - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private normal = 0; - private temporary = 0; - private normaldel = 0; - private temporarydel = 0; - private normalFormIds = []; - private tempFormIds = []; - - private deleteIds = []; - private delCount = 0; - - private normalFormCounts = []; - private tempFormCounts = []; - - private castFormId = "-1"; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private subscriberSendCastForm; - private subscriberSendCastFormEvent = { - events: ["FMS_SendCastForm_commonEvent"], - }; - - private publishOnErrorCallBack() { - console.debug("====> [FormComponent] formsystemhostn formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====> [FormComponent] formsystemhostn formOnAcquiredEvent Publish CallBack ====>"); - } - private publishDeleteCallBack() { - console.debug("====> [FormComponent] formsystemhostn publishDeleteCallBack Publish CallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formCastEvent Publish CallBack ====>"); - } - private startAbility(bundleName, abilityName, sendMsg) { - featureAbility.startAbility({ - want: { - bundleName: bundleName, - abilityName: abilityName, - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName": "entry", - "temporary": false, - "sendCastForm": true, - "sendCastFormMsg": sendMsg, - "isCreate": false - } - } - }).then((res: any) => { - console.info(`[FormComponent] formsystemhostn featureAbility.startAbility res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`[FormComponent] formsystemhostn featureAbility.startAbility error: ${JSON.stringify(err)}`); - }); - } - - private publishOnSendCastForm(err, data) { - console.info("!!!====>[FormComponent] formsystemhostn OnSendCastForm start:====>" + JSON.stringify(data)); - if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhostn") { - return; - } - let formId = data.parameters.castFormId; - setTimeout(function () { - console.info("[FormComponent.host] castTempForm start, formId: " + formId); - formManager.castTempForm(formId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", data.toString()); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); - this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", error.code.toString()); - }); - console.info("[FormComponent.host] castTempForm end"); - }, 5000); - console.info("!!!====>[FormComponent] formsystemhostn OnSendCastForm end"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>[FormComponent] formsystemhostn deleteCallBack start:====>" + JSON.stringify(data)); - const delFormIds = data.parameters.formIds; - console.info(`[FormComponent] data size ${delFormIds.length}`); - - console.info(`[FormComponent] data.subscriber ${JSON.stringify(this.subscriberDel)}`); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); - }); - console.info(`[FormComponent] data.bundleName ${JSON.stringify(data.bundleName)}`); - console.info(`[FormComponent] tof ${"com.ohos.st.formsystemhostn" != data.bundleName}`); - if ("com.ohos.st.formsystemhostn" != data.bundleName) { - return; - } - delFormIds.forEach(async (formId, index) => { - console.info(`[FormComponent] formsystemhostn deleteForm ${index}`); - try { - const res = await formManager.deleteForm(formId); - console.info(`[FormComponent] formsystemhostn deleteForm ${index} ${formId} result: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`[FormComponent] formsystemhostn deleteForm ${index} ${formId} error: ${JSON.stringify(error)}`); - } - }); - console.info("!!!====> [FormComponent] formsystemhostn optType deleteCallBack end ====>"); - } - - private unSubscribeDeleteCallback() { - console.debug("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); - } - - private unSubscribeCastFormCallback() { - console.debug("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>[FormComponent] formsystemhostn Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - commonEvent.subscribe(this.subscriberDel, (err, data) => { - if ("com.ohos.st.formsystemhostn" != data.bundleName) { - return; - } else { - console.info("!!!====>[FormComponent.hostn] formsystemhostn deleteCallBack start:====>" + JSON.stringify(data)); - const delFormIds = data.parameters.formIds; - console.info(`[FormComponent] data size ${delFormIds.length}`); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); - }); - let delCounter = 0; - delFormIds.forEach((formId) => { - formManager.deleteForm(formId, (error, data) => { - console.info(`[FormComponent] formsystemhostn deleteForm ${++delCounter} ${formId} data: ${JSON.stringify(data)} err: ${JSON.stringify(error)}`); - }); - }); - } - }); - }); - - commonEvent.createSubscriber(this.subscriberSendCastFormEvent).then(async (data) => { - console.info("====>[FormComponent] formsystemhostn Subscriber SendCastForm data:====>", JSON.stringify(data)); - this.subscriberSendCastForm = data; - await commonEvent.subscribe(this.subscriberSendCastForm, this.publishOnSendCastForm); - }); - - featureAbility.getWant() - .then(async (want: any) => { - console.info(" [FormComponent] formsystemhostn getWant:" + JSON.stringify(want)); - - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - - if (want.parameters.normal) { - this.normal = want.parameters.normal; - } - - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.normaldel) { - this.normaldel = want.parameters.normaldel; - } - - if (want.parameters.temporarydel) { - this.temporarydel = want.parameters.temporarydel; - } - - if (want.parameters.deleteIds) { - this.deleteIds = want.parameters.deleteIds; - } - if (want.parameters.castFormId) { - this.castFormId = want.parameters.castFormId; - } - - if (want.parameters.releaseFormId) { - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); - }); - - const formId = want.parameters.releaseFormId; - const isReleaseCache = want.parameters.isReleaseCache; - const res = await formManager.releaseForm(formId, isReleaseCache); - console.info(`[FormComponent] releaseForm res: ${JSON.stringify(res)}`); - const commonEventPublishData = { - data: `releaseForm`, - bundleName: `com.ohos.st.formsystemhostn`, - parameters: { - formIds: [].concat(formId) - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - - this.normal = 1; - } - - this.makeCount(); - - setTimeout(() => { - this.optType = want.parameters.optType; - console.info(' [FormComponent] formsystemhostn getWant optType:' + this.optType); - }, 10); - - if (this.castFormId != "-1" && want.parameters.optType == 3) { - console.info("[FormComponent.host] castTempForm start"); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); - }); - - formManager.castTempForm(this.castFormId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - let commonEventPublishData = { - data: data || `0`, - bundleName: "com.ohos.st.formsystemhostn", - parameters: { - formId: this.castFormId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + error.code); - let commonEventPublishData = { - data: error.code.toString(), - errMsg: error.msg, - bundleName: "com.ohos.st.formsystemhostn", - parameters: { - formId: this.castFormId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }); - console.info("[FormComponent.host] castTempForm end"); - } - - if (want.parameters.optType == 2 && this.deleteIds.length > 0) { - for (let iIndex = 0; iIndex < this.deleteIds.length; ++iIndex) { - console.info("[FormComponent] formsystemhostn deleteForm start"); - formManager.deleteForm(this.deleteIds[iIndex]) - .then((data) => { - console.info('[FormComponent] formsystemhostn deleteForm result:' + data); - this.delCount++; - - if (this.delCount == this.deleteIds.length) { - let commonEventPublishData = { - data: data.toString(), - bundleName: "com.ohos.st.formsystemhostn", - parameters: { - "formIds": this.deleteIds - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishDeleteCallBack); - } - }) - .catch((error) => { - console.info(' [FormComponent] formsystemhostn deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - bundleName: "com.ohos.st.formsystemhostn", - parameters: { - "formIds": [this.deleteIds[iIndex]] - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.info("[FormComponent] formsystemhostn deleteForm end"); - } - } - }) - .catch((error: any) => { - console.error(' [FormComponent] formsystemhostn Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.info(`[FormComponent.host] aboutToAppear end`); - } - - private makeCount() { - console.info(' [FormComponent] formsystemhostn makeCount start.'); - for (let nNormal = 0; nNormal < this.normal; nNormal++) { - this.normalFormCounts.push(nNormal); - } - console.info(' [FormComponent] formsystemhostn this.normalFormCounts.length:' + this.normalFormCounts.length); - - for (let nTemp = 0; nTemp < this.temporary; nTemp++) { - this.tempFormCounts.push(nTemp); - } - console.info(' [FormComponent] formsystemhostn this.tempFormCounts.length:' + this.tempFormCounts.length); - } - - build() { - Scroll(new Scroller()) { - Column() { - if (this.optType == 1) { - Text(' [FormComponent] formsystemhostn normal form component test begin') - Grid() { - ForEach(this.normalFormCounts, (item) => { - GridItem() { - FormComponent({ - id: 0, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: false - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(" [FormComponent] formsystemhostn get normal form, form id:" + form.id); - - this.normalFormIds.push(form.id.toString()); - if (this.normalFormIds.length == this.normal - this.normaldel) { - let commonEventPublishData = { - data: "normalForm", - bundleName: "com.ohos.st.formsystemhostn", - parameters: { - "formIds": this.normalFormIds - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onError((error) => { - console.info(" [FormComponent] formsystemhostn normal form error code:" + error.errcode); - console.info(" [FormComponent] formsystemhostn normal form error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg, - bundleName: "com.ohos.st.formsystemhostn" - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .size({ width: 40, height: 40 }) - } - }, (item) => JSON.stringify(item)) - } - .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') - .columnsGap(2) - .rowsGap(2) - .width('100%') - Text(' [FormComponent] formsystemhostn normal form component test end') - - Text(' [FormComponent] formsystemhostn temp form component test start') - Grid() { - ForEach(this.tempFormCounts, (item) => { - GridItem() { - FormComponent({ - id: 0, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: true - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(" [FormComponent] formsystemhostn get temp form, form id:" + form.id); - this.tempFormIds.push(form.id.toString()); - if (this.tempFormIds.length == this.temporary - this.temporarydel) { - let commonEventPublishData = { - data: "tempForm", - bundleName: "com.ohos.st.formsystemhostn", - parameters: { - "formIds": this.tempFormIds - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onError((error) => { - console.info(" [FormComponent] formsystemhostn temp form error code:" + error.errcode); - console.info(" [FormComponent] formsystemhostn temp form error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg, - bundleName: "com.ohos.st.formsystemhostn" - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .size({ width: 40, height: 40 }) - } - }, (item) => JSON.stringify(item)) - } - .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') - .columnsGap(2) - .rowsGap(2) - .width('100%') - - Text(' [FormComponent] formsystemhostn temp form component test end') - } - } - .backgroundColor(Color.White) - } - .scrollable(ScrollDirection.Vertical) - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/element/string.json deleted file mode 100644 index a92ae9f033e94fcb61f4dc7bb745b4403f427bcb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostN" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/BUILD.gn deleted file mode 100644 index ee371aeacba39f85e0b03f6aaa76189854c8aaf8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostNoPerm") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostNoPerm" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json deleted file mode 100644 index 4dd2ebce23f4b3b1e06b560be819a6820f9ec6d3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostnoperm", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostnoperm", - "name": ".FormStHostAppNoPerm", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 4bc1a76a3696910add8590c4ea6e601092da7228..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,335 +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 commonEvent from '@ohos.commonEvent'; -import featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; - -@Entry -@Component -struct Index { - @State formId: number = 0; - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State canCreateForm: boolean = false; - - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private stateForm = "visible"; - private stateIds = []; - private requestForm = false; - private requestId = "-1"; - private releaseForm = false; - private releaseId = "-1"; - private deleteForm = false; - private deleteId = "-1"; - private temporary = false; - private castForm = false; - - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; - private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; - private formOnStateEvent = "FMS_FormOnState_commonEvent"; - - private publishCallBack() { - console.debug("====>formOnErrorEvent Publish CallBack ====>"); - } - - private aboutToAppear() { - console.error('[FormComponent] getWant'); - featureAbility.getWant() - .then((want: any) => { - this.formId = parseInt(want.parameters.formId); - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if(want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - if(want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if(want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - if(want.parameters.castForm) { - this.castForm = want.parameters.castForm; - } - if(want.parameters.deleteForm) { - this.deleteForm = want.parameters.deleteForm; - } - if(want.parameters.deleteId) { - this.deleteId = want.parameters.deleteId; - } - if(want.parameters.releaseForm) { - this.releaseForm = want.parameters.releaseForm; - } - if(want.parameters.releaseId) { - this.releaseId = want.parameters.releaseId; - } - if(want.parameters.requestForm) { - this.requestForm = want.parameters.requestForm; - } - if(want.parameters.requestId) { - this.requestId = want.parameters.requestId; - } - if(want.parameters.stateForm) { - this.stateForm = want.parameters.stateForm; - } - if(want.parameters.stateIds) { - this.stateIds = want.parameters.stateIds; - } - - setTimeout(() => { - this.canCreateForm = want.parameters.isCreate ? true : false; - console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); - }, 10); - console.error('[FormComponent] getWant end'+ JSON.stringify(want)); - - if(!want.parameters.isCreate && this.deleteForm) { - console.log("formsystemhostnoperm deleteForm start"); - formManager.deleteForm(this.deleteId) - .then((data) => { - console.info('formsystemhostnoperm deleteForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('formsystemhostnoperm deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.deleteId.toString() - } - }; - commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishCallBack); - }); - - console.log("formsystemhostnoperm deleteForm end"); - } - - if(!want.parameters.isCreate && this.releaseForm) { - console.log("formsystemhost releaseForm start"); - formManager.releaseForm(this.releaseId) - .then((data) => { - console.info('formsystemhost releaseForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('formsystemhost releaseForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.releaseId.toString() - } - }; - commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishCallBack); - }); - - console.log("formsystemhost releaseForm end"); - } - - if(!want.parameters.isCreate && this.requestForm) { - console.log("[FormComponent.host] requestForm start"); - formManager.requestForm(this.requestId) - .then((data) => { - console.info('[FormComponent] requestForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.requestId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('[FormComponent] requestForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.requestId - } - }; - commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.publishCallBack); - }); - - console.log("[FormComponent.host] requestForm end"); - } - if(!want.parameters.isCreate && this.stateForm) { - if(this.stateForm == "visible") { - console.log("formsystemhost notifyVisibleForm start"); - formManager.notifyVisibleForms(this.stateIds) - .then((data) => { - console.info('formsystemhost notifyVisibleForm result:' + data); - let retData = "0"; - if(data == 0) { - retData = data.toString(); - } else { - retData = data.code.toString(); - } - let commonEventPublishData = { - data: retData, - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('formsystemhost notifyVisibleForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }); - console.log("formsystemhost notifyVisibleForm end"); - } else if(this.stateForm == "invisible") { - console.log("formsystemhost notifyInvisibleForm start"); - formManager.notifyInvisibleForms(this.stateIds) - .then((data) => { - console.info('formsystemhost notifyInvisibleForm result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('formsystemhost notifyInvisibleForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }); - console.log("formsystemhost notifyInvisibleForm end"); - } else if(this.stateForm == "enable") { - console.log("formsystemhost enableFormsUpdate start"); - formManager.enableFormsUpdate(this.stateIds) - .then((data) => { - console.info('formsystemhost enableFormsUpdate result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('formsystemhost enableFormsUpdate error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }); - console.log("formsystemhost enableFormsUpdate end"); - } else { - console.log("formsystemhost disableFormsUpdate start"); - formManager.disableFormsUpdate(this.stateIds) - .then((data) => { - console.info('formsystemhost disableFormsUpdate result:' + data); - let commonEventPublishData = { - data: data.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }) - .catch((error) => { - console.info('formsystemhost disableFormsUpdate error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - parameters: { - "formId" : this.stateIds.toString() - } - }; - commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); - }); - console.log("formsystemhost disableFormsUpdate end"); - } - } - - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - - console.log(`[FormComponent.host] aboutToAppear end`); - } - - build() { - Column() { - Text('form component test begin') - Column() { - if (this.canCreateForm) { - FormComponent({ - id: this.formId, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: this.temporary, - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - this.formId = form.id; - console.log("[FormComponent.host] get form, form id:" + form.id); - }) - .onError((error) => { - console.log("[FormComponent.host] error code:" + error.errcode); - console.log("[FormComponent.host] error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishCallBack); - }) - } - } - .backgroundColor(Color.White) - Text('form component test end') - } - .backgroundColor(Color.White) - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9fbbb3f68ca2efbbaa315fbc8c7c087bd07b9ab6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostNoPerm" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/BUILD.gn deleted file mode 100644 index 2cb109dd4c7513203d2b00d55089e85b16af1d89..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostO") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostO" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json deleted file mode 100644 index ce6b5e2194318dec80e6674ed341624323d4e643..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhosto", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhosto", - "name": ".FormStHostAppO", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_SendCastForm_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormCast_commonEvent" - }, - { - "name": "FMS_SendCastForm_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ef8e33d681a1b36f59b7b3b10a3d7a0eb845a287..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,432 +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 featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; -import commonEvent from '@ohos.commonEvent'; - -@Entry -@Component -struct Index { - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.FormAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State optType: number = 0; - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private normal = 0; - private temporary = 0; - private normaldel = 0; - private temporarydel = 0; - private normalFormIds = []; - private tempFormIds = []; - - private deleteIds = []; - private delCount = 0; - - private normalFormCounts = []; - private tempFormCounts = []; - - private castFormId = "-1"; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private subscriberSendCastForm; - private subscriberSendCastFormEvent = { - events: ["FMS_SendCastForm_commonEvent"], - }; - - private publishOnErrorCallBack() { - console.debug("====> [FormComponent] formsystemhosto formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====> [FormComponent] formsystemhosto formOnAcquiredEvent Publish CallBack ====>"); - } - private publishDeleteCallBack() { - console.debug("====> [FormComponent] formsystemhosto publishDeleteCallBack Publish CallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formCastEvent Publish CallBack ====>"); - } - private startAbility(bundleName, abilityName, sendMsg) { - featureAbility.startAbility({ - want: { - bundleName: bundleName, - abilityName: abilityName, - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "sendCastForm": true, - "sendCastFormMsg": sendMsg, - "isCreate": false - } - } - }).then((res: any) => { - console.info(`[FormComponent] formsystemhosto featureAbility.startAbility res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`[FormComponent] formsystemhosto featureAbility.startAbility error: ${JSON.stringify(err)}`); - }); - } - private publishOnSendCastForm(err, data) { - console.info("!!!====>[FormComponent] formsystemhosto OnSendCastForm start:====>" + JSON.stringify(data)); - if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhosto") { - return; - } - let formId = data.parameters.castFormId; - setTimeout(function () { - console.info("[FormComponent.host] castTempForm start, formId: " + formId); - formManager.castTempForm(formId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", data.toString()); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); - this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", error.code.toString()); - }); - console.info("[FormComponent.host] castTempForm end"); - }, 5000); - console.info("!!!====>[FormComponent] formsystemhosto OnSendCastForm end"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>[FormComponent] formsystemhosto deleteCallBack start:====>" + JSON.stringify(data)); - const delFormIds = data.parameters.formIds; - console.info(`[FormComponent] data size ${delFormIds.length}`); - - console.info(`[FormComponent] data.subscriber ${JSON.stringify(this.subscriberDel)}`); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); - }); - console.info(`[FormComponent] data.bundleName ${JSON.stringify(data.bundleName)}`); - console.info(`[FormComponent] tof ${"com.ohos.st.formsystemhosto" != data.bundleName}`); - if ("com.ohos.st.formsystemhosto" != data.bundleName) { - return; - } - delFormIds.forEach(async (formId, index) => { - console.info(`[FormComponent] formsystemhosto deleteForm ${index}`); - try { - const res = await formManager.deleteForm(formId); - console.info(`[FormComponent] formsystemhosto deleteForm ${index} ${formId} result: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`[FormComponent] formsystemhosto deleteForm ${index} ${formId} error: ${JSON.stringify(error)}`); - } - }); - console.info("!!!====> [FormComponent] formsystemhosto optType deleteCallBack end ====>"); - } - - private unSubscribeDeleteCallback() { - console.debug("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); - } - - private unSubscribeCastFormCallback() { - console.debug("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); - } - - private aboutToAppear() { - const TAG = "[FormComponent.hosto]"; - - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>[FormComponent] formsystemhosto Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - commonEvent.subscribe(this.subscriberDel, (err, data) => { - if ("com.ohos.st.formsystemhosto" != data.bundleName) { - return; - } else { - console.info("!!!====>[FormComponent.hosto] formsystemhosto deleteCallBack start:====>" + JSON.stringify(data)); - const delFormIds = data.parameters.formIds; - console.info(`[FormComponent] data size ${delFormIds.length}`); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); - }); - let delCounter = 0; - delFormIds.forEach((formId) => { - formManager.deleteForm(formId, (error, data) => { - console.info(`[FormComponent] formsystemhosto deleteForm ${++delCounter} ${formId} data: ${JSON.stringify(data)} err: ${JSON.stringify(error)}`); - }); - }); - } - }); - }); - - commonEvent.createSubscriber(this.subscriberSendCastFormEvent).then(async (data) => { - console.info("====>[FormComponent] formsystemhosto Subscriber SendCastForm data:====>", JSON.stringify(data)); - this.subscriberSendCastForm = data; - await commonEvent.subscribe(this.subscriberSendCastForm, this.publishOnSendCastForm); - }); - - featureAbility.getWant() - .then((want: any) => { - console.info(" [FormComponent] formsystemhosto getWant:" + JSON.stringify(want)); - - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - - if (want.parameters.normal) { - this.normal = want.parameters.normal; - } - - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.normaldel) { - this.normaldel = want.parameters.normaldel; - } - - if (want.parameters.temporarydel) { - this.temporarydel = want.parameters.temporarydel; - } - - if (want.parameters.deleteIds) { - this.deleteIds = want.parameters.deleteIds; - } - if (want.parameters.castFormId) { - this.castFormId = want.parameters.castFormId; - } - - this.makeCount(); - - setTimeout(() => { - this.optType = want.parameters.optType; - console.info(' [FormComponent] formsystemhosto getWant optType:' + this.optType); - }, 10); - - if (this.castFormId != "-1" && want.parameters.optType == 3) { - console.info("[FormComponent.host] castTempForm start"); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); - }); - - formManager.castTempForm(this.castFormId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - let commonEventPublishData = { - data: data || `0`, - bundleName: "com.ohos.st.formsystemhosto", - parameters: { - formId: this.castFormId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); - let commonEventPublishData = { - data: error.code.toString(), - bundleName: "com.ohos.st.formsystemhosto", - parameters: { - errMsg: error.message, - formId: this.castFormId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }); - console.info("[FormComponent.host] castTempForm end"); - } - - if (want.parameters.optType == 2 && this.deleteIds.length > 0) { - for (let iIndex = 0; iIndex < this.deleteIds.length; ++iIndex) { - console.info("[FormComponent] formsystemhosto deleteForm start"); - formManager.deleteForm(this.deleteIds[iIndex]) - .then((data) => { - console.info('[FormComponent] formsystemhosto deleteForm result:' + data); - this.delCount++; - - if (this.delCount == this.deleteIds.length) { - let commonEventPublishData = { - data: data.toString(), - bundleName: "com.ohos.st.formsystemhosto", - parameters: { - "formIds": this.deleteIds - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishDeleteCallBack); - } - }) - .catch((error) => { - console.info(' [FormComponent] formsystemhosto deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - bundleName: "com.ohos.st.formsystemhosto", - parameters: { - "formIds": [this.deleteIds[iIndex]] - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.info("[FormComponent] formsystemhosto deleteForm end"); - } - } - }) - .catch((error: any) => { - console.error(' [FormComponent] formsystemhosto Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.info(`[FormComponent.host] aboutToAppear end`); - } - - private makeCount() { - console.info(' [FormComponent] formsystemhosto makeCount start.'); - for (let nNormal = 0; nNormal < this.normal; nNormal++) { - this.normalFormCounts.push(nNormal); - } - console.info(' [FormComponent] formsystemhosto this.normalFormCounts.length:' + this.normalFormCounts.length); - - for (let nTemp = 0; nTemp < this.temporary; nTemp++) { - this.tempFormCounts.push(nTemp); - } - console.info(' [FormComponent] formsystemhosto this.tempFormCounts.length:' + this.tempFormCounts.length); - } - - build() { - Scroll(new Scroller()) { - Column() { - if (this.optType == 1) { - Text(' [FormComponent] formsystemhosto normal form component test begin') - Grid() { - ForEach(this.normalFormCounts, (item) => { - GridItem() { - FormComponent({ - id: 0, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: false - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(" [FormComponent] formsystemhosto get normal form, form id:" + form.id); - - this.normalFormIds.push(form.id.toString()); - if (this.normalFormIds.length == this.normal - this.normaldel) { - let commonEventPublishData = { - data: "normalForm", - bundleName: "com.ohos.st.formsystemhosto", - parameters: { - "formIds": this.normalFormIds - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onError((error) => { - console.info(" [FormComponent] formsystemhosto normal form error code:" + error.errcode); - console.info(" [FormComponent] formsystemhosto normal form error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg, - bundleName: "com.ohos.st.formsystemhosto" - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .size({ width: 40, height: 40 }) - } - }, (item) => JSON.stringify(item)) - } - .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') - .columnsGap(2) - .rowsGap(2) - .width('100%') - Text(' [FormComponent] formsystemhosto normal form component test end') - - Text(' [FormComponent] formsystemhosto temp form component test start') - Grid() { - ForEach(this.tempFormCounts, (item) => { - GridItem() { - FormComponent({ - id: 0, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: true - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(" [FormComponent] formsystemhosto get temp form, form id:" + form.id); - this.tempFormIds.push(form.id.toString()); - if (this.tempFormIds.length == this.temporary - this.temporarydel) { - let commonEventPublishData = { - data: "tempForm", - bundleName: "com.ohos.st.formsystemhosto", - parameters: { - "formIds": this.tempFormIds - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onError((error) => { - console.info(" [FormComponent] formsystemhosto temp form error code:" + error.errcode); - console.info(" [FormComponent] formsystemhosto temp form error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg, - bundleName: "com.ohos.st.formsystemhosto" - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .size({ width: 40, height: 40 }) - } - }, (item) => JSON.stringify(item)) - } - .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') - .columnsGap(2) - .rowsGap(2) - .width('100%') - - Text(' [FormComponent] formsystemhosto temp form component test end') - } - } - .backgroundColor(Color.White) - } - .scrollable(ScrollDirection.Vertical) - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/element/string.json deleted file mode 100644 index e9202859eafd7e293c7a071570cbcef3b336a4c5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostO" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/BUILD.gn deleted file mode 100644 index f19869313ea49f1571f35bbfa46654eb752e86be..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemHostP") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormSystemHostP" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/Test.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json deleted file mode 100644 index cc425ebdd7e6b6feaf12a61ed170dbcf7e4ca3b0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemhostp", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemhostp", - "name": ".FormStHostAppP", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_SendCastForm_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent" - }, - { - "name": "FMS_FormCast_commonEvent" - }, - { - "name": "FMS_SendCastForm_commonEvent" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.REQUIRE_FORM" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f49f9bd10ebd29ce7eb0445bee5a5928d9212a8a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent.host] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent.host] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index e91fed1e065c25c972e24469330a08cb76351144..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,422 +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 featureAbility from "@ohos.ability.featureAbility"; -import formManager from '@ohos.application.formHost'; -import commonEvent from '@ohos.commonEvent'; - -@Entry -@Component -struct Index { - @State bundle: string = "com.form.formsystemtestservicea.hmservice"; - @State ability: string = "com.form.formsystemtestservicea.hmservice.FormAbility"; - @State moduleName: string = "entry"; - @State name: string = "Form_Js001"; - @State allowUpate: boolean = true; - @State isShowing: boolean = true; - @State optType: number = 0; - private dimension: FormDimension = FormDimension.Dimension_1_2; - - private normal = 0; - private temporary = 0; - private normaldel = 0; - private temporarydel = 0; - private normalFormIds = []; - private tempFormIds = []; - - private deleteIds = []; - private delCount = 0; - - private normalFormCounts = []; - private tempFormCounts = []; - - private castFormId = "-1"; - - private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; - private formOnErrorEvent = "FMS_FormOnError_commonEvent"; - private formCastEvent = "FMS_FormCast_commonEvent"; - - private subscriberDel; - private subscriberFormDeleteEvent = { - events: ["FMS_FormDelete_commonEvent"], - }; - - private subscriberSendCastForm; - private subscriberSendCastFormEvent = { - events: ["FMS_SendCastForm_commonEvent"], - }; - - private publishOnErrorCallBack() { - console.debug("====> [FormComponent] formsystemhostp formOnErrorEvent Publish CallBack ====>"); - } - private publishOnAcquiredCallBack() { - console.debug("====> [FormComponent] formsystemhostp formOnAcquiredEvent Publish CallBack ====>"); - } - private publishDeleteCallBack() { - console.debug("====> [FormComponent] formsystemhostp publishDeleteCallBack Publish CallBack ====>"); - } - private publishCastCallBack() { - console.debug("====>formCastEvent Publish CallBack ====>"); - } - private startAbility(bundleName, abilityName, sendMsg) { - featureAbility.startAbility({ - want: { - bundleName: bundleName, - abilityName: abilityName, - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "sendCastForm": true, - "sendCastFormMsg": sendMsg, - "isCreate": false - } - } - }).then((res: any) => { - console.info(`[FormComponent] formsystemhostp featureAbility.startAbility res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`[FormComponent] formsystemhostp featureAbility.startAbility error: ${JSON.stringify(err)}`); - }); - } - private publishOnSendCastForm(err, data) { - console.info("!!!====>[FormComponent] formsystemhostp OnSendCastForm start:====>" + JSON.stringify(data)); - if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhostp") { - return; - } - let formId = data.parameters.castFormId; - setTimeout(function () { - console.info("[FormComponent.host] castTempForm start, formId: " + formId); - formManager.castTempForm(formId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", data.toString()); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); - this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", error.code.toString()); - }); - console.info("[FormComponent.host] castTempForm end"); - }, 5000); - console.info("!!!====>[FormComponent] formsystemhostp OnSendCastForm end"); - } - - private deleteCallBack(err, data) { - console.info("!!!====>[FormComponent] formsystemhostp deleteCallBack start:====>" + JSON.stringify(data)); - const delFormIds = data.parameters.formIds; - console.info(`[FormComponent] data size ${delFormIds.length}`); - - console.info(`[FormComponent] data.subscriber ${JSON.stringify(this.subscriberDel)}`); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostp optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostp optType unSubscribeCastFormCallback CallBack====>"); - }); - console.info(`[FormComponent] data.bundleName ${JSON.stringify(data.bundleName)}`); - console.info(`[FormComponent] tof ${"com.ohos.st.formsystemhostp" != data.bundleName}`); - if ("com.ohos.st.formsystemhostp" != data.bundleName) { - return; - } - delFormIds.forEach(async (formId, index) => { - console.info(`[FormComponent] formsystemhostp deleteForm ${index}`); - try { - const res = await formManager.deleteForm(formId); - console.info(`[FormComponent] formsystemhostp deleteForm ${index} ${formId} result: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`[FormComponent] formsystemhostp deleteForm ${index} ${formId} error: ${JSON.stringify(error)}`); - } - }); - console.info("!!!====> [FormComponent] formsystemhostp optType deleteCallBack end ====>"); - } - - private aboutToAppear() { - commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { - console.info("====>[FormComponent] formsystemhostp Subscriber FormDelete data:====>", JSON.stringify(data)); - this.subscriberDel = data; - commonEvent.subscribe(this.subscriberDel, (err, data) => { - if ("com.ohos.st.formsystemhostp" != data.bundleName) { - return; - } else { - console.info("!!!====>[FormComponent.hostp] formsystemhostp deleteCallBack start:====>" + JSON.stringify(data)); - const delFormIds = data.parameters.formIds; - console.info(`[FormComponent] data size ${delFormIds.length}`); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostp optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostp optType unSubscribeCastFormCallback CallBack====>"); - }); - let delCounter = 0; - delFormIds.forEach((formId) => { - formManager.deleteForm(formId, (error, data) => { - console.info(`[FormComponent] formsystemhostp deleteForm ${++delCounter} ${formId} data: ${JSON.stringify(data)} err: ${JSON.stringify(error)}`); - }); - }); - } - }); - }); - - commonEvent.createSubscriber(this.subscriberSendCastFormEvent).then(async (data) => { - console.info("====>[FormComponent] formsystemhostp Subscriber SendCastForm data:====>", JSON.stringify(data)); - this.subscriberSendCastForm = data; - await commonEvent.subscribe(this.subscriberSendCastForm, this.publishOnSendCastForm); - }); - - featureAbility.getWant() - .then((want: any) => { - console.info(" [FormComponent] formsystemhostp getWant:" + JSON.stringify(want)); - - this.name = want.parameters.name; - this.bundle = want.parameters.bundle; - this.ability = want.parameters.ability; - if (want.parameters.moduleName) { - this.moduleName = want.parameters.moduleName; - } - - if (want.parameters.dimension) { - this.dimension = want.parameters.dimension; - } - - if (want.parameters.normal) { - this.normal = want.parameters.normal; - } - - if (want.parameters.temporary) { - this.temporary = want.parameters.temporary; - } - if (want.parameters.normaldel) { - this.normaldel = want.parameters.normaldel; - } - - if (want.parameters.temporarydel) { - this.temporarydel = want.parameters.temporarydel; - } - - if (want.parameters.deleteIds) { - this.deleteIds = want.parameters.deleteIds; - } - if (want.parameters.castFormId) { - this.castFormId = want.parameters.castFormId; - } - - this.makeCount(); - - setTimeout(() => { - this.optType = want.parameters.optType; - console.info(' [FormComponent] formsystemhostp getWant optType:' + this.optType); - }, 10); - - if (this.castFormId != "-1" && want.parameters.optType == 3) { - console.info("[FormComponent.host] castTempForm start"); - commonEvent.unsubscribe(this.subscriberDel, () => { - console.info("====> [FormComponent] formsystemhostp optType unSubscribeDeleteCallback CallBack====>"); - }); - commonEvent.unsubscribe(this.subscriberSendCastForm, () => { - console.info("====> [FormComponent] formsystemhostp optType unSubscribeCastFormCallback CallBack====>"); - }); - - formManager.castTempForm(this.castFormId) - .then((data) => { - console.info('[FormComponent] castTempForm result:' + data); - let commonEventPublishData = { - data: data || `0`, - bundleName: "com.ohos.st.formsystemhostp", - parameters: { - formId: this.castFormId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }) - .catch((error) => { - console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); - let commonEventPublishData = { - data: error.code.toString(), - bundleName: "com.ohos.st.formsystemhostp", - parameters: { - errMsg: error.message, - formId: this.castFormId.toString() - } - }; - commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); - }); - console.info("[FormComponent.host] castTempForm end"); - } - - if (want.parameters.optType == 2 && this.deleteIds.length > 0) { - for (let iIndex = 0; iIndex < this.deleteIds.length; ++iIndex) { - console.info("[FormComponent] formsystemhostp deleteForm start"); - formManager.deleteForm(this.deleteIds[iIndex]) - .then((data) => { - console.info('[FormComponent] formsystemhostp deleteForm result:' + data); - this.delCount++; - - if (this.delCount == this.deleteIds.length) { - let commonEventPublishData = { - data: data.toString(), - bundleName: "com.ohos.st.formsystemhostp", - parameters: { - "formIds": this.deleteIds - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishDeleteCallBack); - } - }) - .catch((error) => { - console.info(' [FormComponent] formsystemhostp deleteForm error:' + error); - let commonEventPublishData = { - data: error.code.toString(), - bundleName: "com.ohos.st.formsystemhostp", - parameters: { - "formIds": [this.deleteIds[iIndex]] - } - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }); - console.info("[FormComponent] formsystemhostp deleteForm end"); - } - } - }) - .catch((error: any) => { - console.error(' [FormComponent] formsystemhostp Operation failed. Cause: ' + JSON.stringify(error)); - }) - console.info(`[FormComponent.host] aboutToAppear end`); - } - - private makeCount() { - console.info(' [FormComponent] formsystemhostp makeCount start.'); - for (let nNormal = 0; nNormal < this.normal; nNormal++) { - this.normalFormCounts.push(nNormal); - } - console.info(' [FormComponent] formsystemhostp this.normalFormCounts.length:' + this.normalFormCounts.length); - - for (let nTemp = 0; nTemp < this.temporary; nTemp++) { - this.tempFormCounts.push(nTemp); - } - console.info(' [FormComponent] formsystemhostp this.tempFormCounts.length:' + this.tempFormCounts.length); - } - - build() { - Scroll(new Scroller()) { - Column() { - if (this.optType == 1) { - Text(' [FormComponent] formsystemhostp normal form component test begin') - Grid() { - ForEach(this.normalFormCounts, (item) => { - GridItem() { - FormComponent({ - id: 0, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: false - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(" [FormComponent] formsystemhostp get normal form, form id:" + form.id); - - this.normalFormIds.push(form.id.toString()); - if (this.normalFormIds.length == this.normal - this.normaldel) { - let commonEventPublishData = { - data: "normalForm", - bundleName: "com.ohos.st.formsystemhostp", - parameters: { - "formIds": this.normalFormIds - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onError((error) => { - console.info(" [FormComponent] formsystemhostp normal form error code:" + error.errcode); - console.info(" [FormComponent] formsystemhostp normal form error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg, - bundleName: "com.ohos.st.formsystemhostp" - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .size({ width: 40, height: 40 }) - } - }, (item) => JSON.stringify(item)) - } - .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') - .columnsGap(2) - .rowsGap(2) - .width('100%') - Text(' [FormComponent] formsystemhostp normal form component test end') - - Text(' [FormComponent] formsystemhostp temp form component test start') - Grid() { - ForEach(this.tempFormCounts, (item) => { - GridItem() { - FormComponent({ - id: 0, - name: this.name, - bundle: this.bundle, - ability: this.ability, - module: this.moduleName, - dimension: this.dimension, - temporary: true - }) - .allowUpdate(this.allowUpate) - .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) - .onAcquired((form) => { - console.info(" [FormComponent] formsystemhostp get temp form, form id:" + form.id); - this.tempFormIds.push(form.id.toString()); - if (this.tempFormIds.length == this.temporary - this.temporarydel) { - let commonEventPublishData = { - data: "tempForm", - bundleName: "com.ohos.st.formsystemhostp", - parameters: { - "formIds": this.tempFormIds - } - }; - commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); - } - }) - .onError((error) => { - console.info(" [FormComponent] formsystemhostp temp form error code:" + error.errcode); - console.info(" [FormComponent] formsystemhostp temp form error msg:" + error.msg); - let commonEventPublishData = { - data: error.msg, - bundleName: "com.ohos.st.formsystemhostp" - }; - commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); - }) - .size({ width: 40, height: 40 }) - } - }, (item) => JSON.stringify(item)) - } - .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') - .columnsGap(2) - .rowsGap(2) - .width('100%') - - Text(' [FormComponent] formsystemhostp temp form component test end') - } - } - .backgroundColor(Color.White) - } - .scrollable(ScrollDirection.Vertical) - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/element/string.json deleted file mode 100644 index e1cf22f277e3bd0a925cda8f7e3522de240c1f26..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formhostP" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json deleted file mode 100644 index 4936330fa84e13a043415bee128ea8e7e66e7855..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestservicea.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestservicea.hmservice", - "name": ".FormSupplyAppA", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "Form_Js001", - "isDefault": true, - "scheduledUpdateTime": "10:30", - "formVisibleNotify": true, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form 001", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", - "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - }, - { - "jsComponentName":"Form_Js002", - "isDefault":false, - "defaultDimension":"2*2", - "formVisibleNotify":true, - "name":"Form_Js002", - "colorMode":"auto", - "description":"This is a form 002", - "supportDimensions":[ - "1*2", - "2*2" - ], - "type":"JS", - "updateEnabled":true, - "updateDuration":1 - } - ], - "srcLanguage": "ets" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/second" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "Form_Js001", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "reason": "need use FormSupply commonEvent", - "name": "FMS_FormSupply_commonEvent" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index 09124b5db447dbb7cd58da3591d7e05752bcec30..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,88 +0,0 @@ -import formBindingData from '@ohos.application.formBindingData' -import commonEvent from '@ohos.commonEvent' - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - onCreate(want) { - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - count: 10 - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind" : "onCreate", - "parameters" : JSON.stringify(want), - "data" : JSON.stringify(formData) - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - onUpdate(formId) { - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onUpdate", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onCastToNormal(formId) { - console.info('FormAbility onCastTemp, formId: ' + formId); - - var commonEventPublishData = { - parameters: { - "kind" : "onCastToNormal", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onEvent(formId, message) { - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - - var commonEventPublishData = { - parameters: { - "kind" : "onEvent", - "parameters" : formId, - "data" : message - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onVisibilityChange(formEvents) { - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind" : "onVisibilityChange", - "parameters" : JSON.stringify(formEvents), - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onDestroy(formId) { - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onDestroy", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.css b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.css deleted file mode 100644 index 4a7a725b77a0209e0fd19d7872c8d2493ca888bc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.css +++ /dev/null @@ -1,19 +0,0 @@ -#wrapper { - flex-direction: column; -} - -#div1 { - width: 100%; - height: 100%; - justify-content: center; - align-items: center; - background-color: white; -} - -#text1 { - height: 45px; - width: 150px; - font-size: 16px; - text-align: center; -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.hml b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.hml deleted file mode 100644 index cd6106fe7f4cd3e951126de70065073f0bd10a95..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.hml +++ /dev/null @@ -1,7 +0,0 @@ -
-
-
- {{title}} -
-
-
\ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.json deleted file mode 100644 index 376c97a90068b93e4440f5c228289818c62db66b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "actions": {}, - "data": { - "title": "Hello World" - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/element/string.json deleted file mode 100644 index b0e7e3905b9f6f4ffd28fb0f8a2e7ce585cf2ac6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "A提供方" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json deleted file mode 100644 index 20cfeb7f4579dbbbb4413e39e117efc21e81e67e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestserviceb.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestserviceb.hmservice", - "name": ".FormSupplyAppB", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "widget", - "isDefault": true, - "formVisibleNotify": true, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form 001", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", - "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - }, - { - "jsComponentName":"widget", - "isDefault":false, - "defaultDimension":"2*2", - "formVisibleNotify":true, - "name":"Form_Js002", - "colorMode":"auto", - "description":"This is a form 002", - "supportDimensions":[ - "1*2", - "2*2" - ], - "type":"JS", - "updateEnabled":true, - "scheduledUpdateTime": "10:30" - } - ], - "srcLanguage": "ets" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "widget", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index 09124b5db447dbb7cd58da3591d7e05752bcec30..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,88 +0,0 @@ -import formBindingData from '@ohos.application.formBindingData' -import commonEvent from '@ohos.commonEvent' - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - onCreate(want) { - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - count: 10 - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind" : "onCreate", - "parameters" : JSON.stringify(want), - "data" : JSON.stringify(formData) - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - onUpdate(formId) { - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onUpdate", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onCastToNormal(formId) { - console.info('FormAbility onCastTemp, formId: ' + formId); - - var commonEventPublishData = { - parameters: { - "kind" : "onCastToNormal", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onEvent(formId, message) { - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - - var commonEventPublishData = { - parameters: { - "kind" : "onEvent", - "parameters" : formId, - "data" : message - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onVisibilityChange(formEvents) { - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind" : "onVisibilityChange", - "parameters" : JSON.stringify(formEvents), - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onDestroy(formId) { - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onDestroy", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_list.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_list.svg deleted file mode 100644 index 553da281ae4bf91fa43e9a5b849dd792a1e7faa7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_list.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - ic_list - Created with Sketch. - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_vision.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_vision.svg deleted file mode 100644 index 95f75bf2298db8bf39929596b2c708fbb617be80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_vision.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - ic_vision - - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/element/string.json deleted file mode 100644 index ae5f28b1d118a84b9a4a9e5debff087058ae7d99..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "B提供方" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json deleted file mode 100644 index 46fea018cfc773e7934d5136ceca9fa2a087f187..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestserviced.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestserviced.hmservice", - "name": ".FormSupplyAppD", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "widget", - "isDefault": true, - "formVisibleNotify": false, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form 001", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", - "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - }, - { - "jsComponentName":"widget", - "isDefault":false, - "defaultDimension":"2*2", - "formVisibleNotify":true, - "name":"Form_Js002", - "colorMode":"auto", - "description":"This is a form 002", - "supportDimensions":[ - "1*2", - "2*2" - ], - "type":"JS", - "updateEnabled":true, - "scheduledUpdateTime": "10:30" - } - ], - "srcLanguage": "ets" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "widget", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index 33079f82d465413178287da8ec1eb7e312d36ae8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,89 +0,0 @@ -import formBindingData from '@ohos.application.formBindingData' -import formProvider from '@ohos.application.formProvider' -import commonEvent from '@ohos.commonEvent' - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - onCreate(want) { - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - count: 10 - }; - let bindingData = formBindingData.createFormBindingData(formData); - let commonEventPublishData = { - parameters: { - "kind" : "onCreate", - "parameters" : JSON.stringify(want), - "data" : JSON.stringify(formData) - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - onUpdate(formId) { - console.info('FormAbility onUpdate, formId: ' + formId); - let commonEventPublishData = { - parameters: { - "kind" : "onUpdate", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onCastToNormal(formId) { - console.info('FormAbility onCastTemp, formId: ' + formId); - - let commonEventPublishData = { - parameters: { - "kind" : "onCastToNormal", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onEvent(formId, message) { - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - - let commonEventPublishData = { - parameters: { - "kind" : "onEvent", - "parameters" : formId, - "data" : message - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onVisibilityChange(formEvents) { - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind" : "onVisibilityChange", - "parameters" : JSON.stringify(formEvents), - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onDestroy(formId) { - console.info('FormAbility onDestroy, formId: ' + formId); - let commonEventPublishData = { - parameters: { - "kind" : "onDestroy", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_list.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_list.svg deleted file mode 100644 index 553da281ae4bf91fa43e9a5b849dd792a1e7faa7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_list.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - ic_list - Created with Sketch. - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_vision.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_vision.svg deleted file mode 100644 index 95f75bf2298db8bf39929596b2c708fbb617be80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_vision.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - ic_vision - - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/element/string.json deleted file mode 100644 index a45f105e0631dd0ad1c34ba36d59754793bd5ba3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "D提供方" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json deleted file mode 100644 index f9c45d5aa96b580a5205be3cd017b45e4675b90a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestservicee.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestservicee.hmservice", - "name": ".FormSupplyAppE", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "widget", - "isDefault": true, - "scheduledUpdateTime": "10:30", - "formVisibleNotify": true, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form 001", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", - "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - }, - { - "jsComponentName":"widget", - "isDefault":false, - "defaultDimension":"2*2", - "formVisibleNotify":true, - "name":"Form_Js002", - "colorMode":"auto", - "description":"This is a form 002", - "supportDimensions":[ - "1*2", - "2*2" - ], - "type":"JS", - "updateEnabled":true, - "updateDuration":1 - } - ], - "srcLanguage": "ets" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/second" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "widget", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index df452bf7bd9f80167967751ada95c44febfaedb1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,99 +0,0 @@ -import formBindingData from '@ohos.application.formBindingData' -import commonEvent from '@ohos.commonEvent' - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - onCreate(want) { - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - "temperature":"11c", - "time":"11:00", - "test":11, - "test3":true, - "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of' - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind" : "onCreate", - "parameters" : JSON.stringify(want), - "data" : JSON.stringify(formData) - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - onUpdate(formId) { - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onUpdate", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onCastToNormal(formId) { - console.info('FormAbility onCastTemp, formId: ' + formId); - - var commonEventPublishData = { - parameters: { - "kind" : "onCastToNormal", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onEvent(formId, message) { - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - - var commonEventPublishData = { - parameters: { - "kind" : "onEvent", - "parameters" : formId, - "data" : message - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onVisibilityChange(formEvents) { - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind" : "onVisibilityChange", - "parameters" : JSON.stringify(formEvents), - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onDestroy(formId) { - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onDestroy", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_list.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_list.svg deleted file mode 100644 index 553da281ae4bf91fa43e9a5b849dd792a1e7faa7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_list.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - ic_list - Created with Sketch. - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_vision.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_vision.svg deleted file mode 100644 index 95f75bf2298db8bf39929596b2c708fbb617be80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_vision.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - ic_vision - - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/element/string.json deleted file mode 100644 index b0e7e3905b9f6f4ffd28fb0f8a2e7ce585cf2ac6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "A提供方" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index ad6974bb14f6cbd5c15046ea8b6ace48841e6480..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,143 +0,0 @@ -import commonEvent from '@ohos.commonEvent'; -import formBindingData from '@ohos.application.formBindingData'; -import formProvider from '@ohos.application.formProvider'; -import {getCurrentTime} from '@ohos.systemTime'; - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - async onCreate(want) { - const time = await getCurrentTime(); - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - count: 10 - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind": "onCreate", - "parameters": JSON.stringify(want), - "data": JSON.stringify(formData), - "time": time - } - }; - console.info(`FormAbility data ${JSON.stringify(commonEventPublishData)}`); - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - async onUpdate(formId) { - const time = await getCurrentTime(); - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind": "onUpdate", - "parameters": formId, - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - async onCastToNormal(formId) { - const time = await getCurrentTime(); - console.info('FormAbility onCastTemp, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind": "onCastToNormal", - "parameters": formId, - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - async onEvent(formId, message) { - const time = await getCurrentTime(); - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - var commonEventPublishData = { - parameters: { - "kind": "onEvent", - "parameters": formId, - "data": message, - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - async onVisibilityChange(formEvents) { - const time = await getCurrentTime(); - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind": "onVisibilityChange", - "parameters": JSON.stringify(formEvents), - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - - for (let key in formEvents) { - const value = formEvents[key]; - key = key.toString(); - console.log('form_extension onVisibilityChange, key:' + key + ", value=" + value); - let dataObj = { - temperature: "22°", - time: "22:00", - test: 22, - }; - let obj = formBindingData.createFormBindingData(dataObj); - - const updateFormStartTime = await getCurrentTime(); - let data = await formProvider.updateForm(key, obj); - console.info('FormAbility onUpdateForm, res: ' + data); - const updateFormEndTime = await getCurrentTime(); - - commonEventPublishData = { - parameters: { - "kind": "onUpdateForm", - "parameters": key, - "data": "", - "time": updateFormEndTime - updateFormStartTime - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - - const setFormNextRefreshTimeStartTime = await getCurrentTime(); - data = await formProvider.setFormNextRefreshTime(key, 5); - console.info('FormAbility setFormNextRefreshTime, res: ' + data); - const setFormNextRefreshTimeEndTime = await getCurrentTime(); - - commonEventPublishData = { - parameters: { - "kind": "onSetFormNextRefreshTime", - "parameters": key, - "data": "", - "time": setFormNextRefreshTimeEndTime - setFormNextRefreshTimeStartTime - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } - }, - async onDestroy(formId) { - const time = await getCurrentTime(); - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind": "onDestroy", - "parameters": formId, - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_list.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_list.svg deleted file mode 100644 index 553da281ae4bf91fa43e9a5b849dd792a1e7faa7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_list.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - ic_list - Created with Sketch. - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_vision.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_vision.svg deleted file mode 100644 index 95f75bf2298db8bf39929596b2c708fbb617be80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_vision.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - ic_vision - - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/element/string.json deleted file mode 100644 index ff87c28c2065f8e7db6d07b57a616274f20dfb0a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "提供方F" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json deleted file mode 100644 index 3c93e40612c7233dfc3f7db02c91db1289d55968..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestserviceg.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestserviceg.hmservice", - "name": ".FormSupplyAppG", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "Form_Js001", - "isDefault": true, - "scheduledUpdateTime": "10:30", - "formVisibleNotify": true, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form widget", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - } - ], - "srcLanguage": "ets" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/second" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "Form_Js001", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "reason": "need use FormSupply commonEvent", - "name": "FMS_FormSupply_commonEvent" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index 504d3c667e5d4aeca88031677863fad5ec73f353..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,155 +0,0 @@ -import commonEvent from '@ohos.commonEvent'; -import formBindingData from '@ohos.application.formBindingData'; -import formProvider from '@ohos.application.formProvider'; -import {getCurrentTime} from '@ohos.systemTime'; - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - async onCreate(want) { - const time = await getCurrentTime(); - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - temperature: "11°", - time: "11:00", - area: "Shenyang", - epidemic: true, - "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of', - count: 10 - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind": "onCreate", - "parameters": JSON.stringify(want), - "data": JSON.stringify(formData), - "time": time - } - }; - console.info(`FormAbility data ${JSON.stringify(commonEventPublishData)}`); - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - async onUpdate(formId) { - const time = await getCurrentTime(); - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind": "onUpdate", - "parameters": formId, - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - async onCastToNormal(formId) { - const time = await getCurrentTime(); - console.info('FormAbility onCastTemp, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind": "onCastToNormal", - "parameters": formId, - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - async onEvent(formId, message) { - const time = await getCurrentTime(); - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - var commonEventPublishData = { - parameters: { - "kind": "onEvent", - "parameters": formId, - "data": message, - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - async onVisibilityChange(formEvents) { - const time = await getCurrentTime(); - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind": "onVisibilityChange", - "parameters": JSON.stringify(formEvents), - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - - for (let key in formEvents) { - const value = formEvents[key]; - key = key.toString(); - console.log('form_extension onVisibilityChange, key:' + key + ", value=" + value); - let dataObj = { - temperature: "22°", - time: "22:00", - test: 22, - }; - let obj = formBindingData.createFormBindingData(dataObj); - - const updateFormStartTime = await getCurrentTime(); - let data = await formProvider.updateForm(key, obj); - console.info('FormAbility onUpdateForm, res: ' + data); - const updateFormEndTime = await getCurrentTime(); - - commonEventPublishData = { - parameters: { - "kind": "onUpdateForm", - "parameters": key, - "data": "", - "time": updateFormEndTime - updateFormStartTime - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - - const setFormNextRefreshTimeStartTime = await getCurrentTime(); - data = await formProvider.setFormNextRefreshTime(key, 5); - console.info('FormAbility setFormNextRefreshTime, res: ' + data); - const setFormNextRefreshTimeEndTime = await getCurrentTime(); - - commonEventPublishData = { - parameters: { - "kind": "onSetFormNextRefreshTime", - "parameters": key, - "data": "", - "time": setFormNextRefreshTimeEndTime - setFormNextRefreshTimeStartTime - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } - }, - async onDestroy(formId) { - const time = await getCurrentTime(); - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind": "onDestroy", - "parameters": formId, - "data": "", - "time": time - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_list.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_list.svg deleted file mode 100644 index 553da281ae4bf91fa43e9a5b849dd792a1e7faa7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_list.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - ic_list - Created with Sketch. - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_vision.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_vision.svg deleted file mode 100644 index 95f75bf2298db8bf39929596b2c708fbb617be80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_vision.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - ic_vision - - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 28dbacf9ad2b552dd7419a54af311ad239fe9768..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "提供方G" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json deleted file mode 100644 index 8b65064d6fa24e3314f82d68a3e6c23c3cfb95fd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestserviceh.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestserviceh.hmservice", - "name": ".FormSupplyAppH", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "widget", - "isDefault": true, - "scheduledUpdateTime": "10:30", - "formVisibleNotify": true, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form 001", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", - "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - }, - { - "jsComponentName":"widget", - "isDefault":false, - "defaultDimension":"2*2", - "formVisibleNotify":true, - "name":"Form_Js002", - "colorMode":"auto", - "description":"This is a form 002", - "supportDimensions":[ - "1*2", - "2*2" - ], - "type":"JS", - "updateEnabled":true, - "updateDuration":1 - } - ], - "srcLanguage": "ets" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/second" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "widget", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index df452bf7bd9f80167967751ada95c44febfaedb1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,99 +0,0 @@ -import formBindingData from '@ohos.application.formBindingData' -import commonEvent from '@ohos.commonEvent' - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - onCreate(want) { - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - "temperature":"11c", - "time":"11:00", - "test":11, - "test3":true, - "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of' - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind" : "onCreate", - "parameters" : JSON.stringify(want), - "data" : JSON.stringify(formData) - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - onUpdate(formId) { - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onUpdate", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onCastToNormal(formId) { - console.info('FormAbility onCastTemp, formId: ' + formId); - - var commonEventPublishData = { - parameters: { - "kind" : "onCastToNormal", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onEvent(formId, message) { - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - - var commonEventPublishData = { - parameters: { - "kind" : "onEvent", - "parameters" : formId, - "data" : message - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onVisibilityChange(formEvents) { - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind" : "onVisibilityChange", - "parameters" : JSON.stringify(formEvents), - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onDestroy(formId) { - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onDestroy", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_list.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_list.svg deleted file mode 100644 index 553da281ae4bf91fa43e9a5b849dd792a1e7faa7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_list.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - ic_list - Created with Sketch. - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_vision.svg b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_vision.svg deleted file mode 100644 index 95f75bf2298db8bf39929596b2c708fbb617be80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_vision.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - ic_vision - - - - - \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 30145204027130827e3e1c7c61d1fb91d9a5c7ad..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "H提供方" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/Test.json deleted file mode 100644 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json deleted file mode 100644 index ce21273b4bbb9e5539316415e4cd6ef53444cf0a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "app": { - "bundleName": "com.form.formsystemtestservicenotsysapp.hmservice", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 9, - "releaseType": "Release", - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.form.formsystemtestservicenotsysapp.hmservice", - "name": ".FormSupplyAppNS", - "mainAbility": ".MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "name": ".FormAbility", - "srcPath": "FormAbility", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "formsEnabled": true, - "forms": [ - { - "jsComponentName": "Form_Js001", - "isDefault": true, - "scheduledUpdateTime": "10:30", - "formVisibleNotify": true, - "defaultDimension": "1*2", - "name": "Form_Js001", - "description": "This is a form 001", - "colorMode": "auto", - "type": "JS", - "supportDimensions": [ - "1*2", - "2*2" - ], - "updateEnabled": true, - "updateDuration": 1 - }, - { - "jsComponentName":"Form_Js002", - "isDefault":false, - "defaultDimension":"2*2", - "formVisibleNotify":true, - "name":"Form_Js002", - "colorMode":"auto", - "description":"This is a form 002", - "supportDimensions":[ - "1*2", - "2*2" - ], - "type":"JS", - "updateEnabled":true, - "updateDuration":1 - } - ], - "srcLanguage": "ets" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/second" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "Form_Js001", - "window": { - "designWidth": 720, - "autoDesignWidth": true - }, - "type": "form" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "reason": "need use FormSupply commonEvent", - "name": "FMS_FormSupply_commonEvent" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/FormAbility/form.ts b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/FormAbility/form.ts deleted file mode 100644 index df452bf7bd9f80167967751ada95c44febfaedb1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/FormAbility/form.ts +++ /dev/null @@ -1,99 +0,0 @@ -import formBindingData from '@ohos.application.formBindingData' -import commonEvent from '@ohos.commonEvent' - -let supplyForm_Event = "FMS_FormSupply_commonEvent"; - -function publishCallBack() { - console.info("!!!====>FormAbility publishCallBack====>"); -} - -export default { - onCreate(want) { - console.info('FormAbility onCreate, want:' + JSON.stringify(want)); - let formData = { - "temperature":"11c", - "time":"11:00", - "test":11, - "test3":true, - "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + - 'test over 1k of data,test over 1k of' - }; - let bindingData = formBindingData.createFormBindingData(formData); - var commonEventPublishData = { - parameters: { - "kind" : "onCreate", - "parameters" : JSON.stringify(want), - "data" : JSON.stringify(formData) - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - return bindingData; - }, - onUpdate(formId) { - console.info('FormAbility onUpdate, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onUpdate", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onCastToNormal(formId) { - console.info('FormAbility onCastTemp, formId: ' + formId); - - var commonEventPublishData = { - parameters: { - "kind" : "onCastToNormal", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onEvent(formId, message) { - console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); - - var commonEventPublishData = { - parameters: { - "kind" : "onEvent", - "parameters" : formId, - "data" : message - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onVisibilityChange(formEvents) { - console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); - var commonEventPublishData = { - parameters: { - "kind" : "onVisibilityChange", - "parameters" : JSON.stringify(formEvents), - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - }, - onDestroy(formId) { - console.info('FormAbility onDestroy, formId: ' + formId); - var commonEventPublishData = { - parameters: { - "kind" : "onDestroy", - "parameters" : formId, - "data" : "" - } - }; - commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.css b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.css deleted file mode 100644 index 4a7a725b77a0209e0fd19d7872c8d2493ca888bc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.css +++ /dev/null @@ -1,19 +0,0 @@ -#wrapper { - flex-direction: column; -} - -#div1 { - width: 100%; - height: 100%; - justify-content: center; - align-items: center; - background-color: white; -} - -#text1 { - height: 45px; - width: 150px; - font-size: 16px; - text-align: center; -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.hml b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.hml deleted file mode 100644 index cd6106fe7f4cd3e951126de70065073f0bd10a95..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.hml +++ /dev/null @@ -1,7 +0,0 @@ -
-
-
- {{title}} -
-
-
\ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.json deleted file mode 100644 index 376c97a90068b93e4440f5c228289818c62db66b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "actions": {}, - "data": { - "title": "Hello World" - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/element/string.json deleted file mode 100644 index fd46026c39fe3454a5a4f54c2415a43bf1a3e6d0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "NS提供方" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - }, - { - "name": "description_serviceability", - "value": "hap sample empty service" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/BUILD.gn deleted file mode 100644 index 704384d58f9ffd93b187cfd1edb96dbdbdd51af6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemProviderA") { - hap_name = "FormSystemProviderA" - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/Test.json deleted file mode 100644 index ba2697bb640e6f7c293aa11a828cdc3d4836958b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json deleted file mode 100644 index c787cdca9438b7aef80dfc8a2138092b2b5228b0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemprovidera", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemprovidera", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "form_module_a", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "launchType": "standard", - "formsEnabled": true, - "forms": [ - { - "name": "FormA_Js001", - "description": "form_description_FormA_Js001", - "descriptionId": 0, - "isDefault": true, - "type": "JS", - "colorMode": "dark", - "supportDimensions": [ - "1*2", - "2*4" - ], - "defaultDimension": "1*2", - "updateEnabled": true, - "updateDuration": 1, - "scheduledUpdateTime": "5:30", - "jsComponentName": "card_a01", - "formVisibleNotify": true, - "formConfigAbility": "abilitya01", - "metaData": { - "customizeData": [ - { - "name": "originWidgetNameA01", - "value": "valueA01" - } - ] - } - }, - { - "name": "FormA_Js002", - "description": "form_description_FormA_Js002", - "descriptionId": 10, - "isDefault": false, - "type": "JS", - "colorMode": "light", - "supportDimensions": [ - "1*2", - "2*2", - "2*4", - "4*4" - ], - "defaultDimension": "4*4", - "updateEnabled": false, - "updateDuration": 2, - "scheduledUpdateTime": "20:30", - "jsComponentName": "card_a02", - "formVisibleNotify": false, - "formConfigAbility": "abilitya02", - "metaData": { - "customizeData": [ - { - "name": "originWidgetNameA02", - "value": "valueA02" - } - ] - } - } - ] - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 75488d282090db667b2d8cbf3cde36f6281ff8df..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info(`[FormProviderA] Application onCreate`); - }, - onDestroy() { - console.info(`[FormProviderA] Application onDestroy`); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 164e127a04f132e2c35279b4de9079530bb09276..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,62 +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 featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormProviderA`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`Fms Main Ability Test`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/BUILD.gn deleted file mode 100644 index d7a47b5f33003cf881d353297ceac69b079088c6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemProviderB") { - hap_name = "FormSystemProviderB" - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/Test.json deleted file mode 100644 index ba2697bb640e6f7c293aa11a828cdc3d4836958b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json deleted file mode 100644 index 07b1dea2c097e5e98d15438151ac23e7326e16b5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemproviderb", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemproviderb", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "form_module_b", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "launchType": "standard", - "formsEnabled": true, - "forms": [ - { - "name": "FormB_Js001", - "description": "form_description_FormB_Js001", - "descriptionId": 20, - "isDefault": true, - "type": "JS", - "colorMode": "auto", - "supportDimensions": [ - "1*2", - "2*2" - ], - "defaultDimension": "2*2", - "updateEnabled": true, - "updateDuration": 3, - "scheduledUpdateTime": "10:30", - "jsComponentName": "card_b", - "formVisibleNotify": true, - "formConfigAbility": "abilityb", - "metaData": { - "customizeData": [ - { - "name": "originWidgetNameB", - "value": "valueB" - } - ] - } - } - ] - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 50544f4d1e8edcac132de560bd6f4548562955ba..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info(`[FormProviderB] Application onCreate`); - }, - onDestroy() { - console.info(`[FormProviderB] Application onDestroy`); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 074ab288ee04a8fe61bf9cbdff80021c30abe97d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,62 +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 featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormProviderB`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`Fms Main Ability Test`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/BUILD.gn deleted file mode 100644 index a7c6d7d52aee429647d952c814ba7afd838cfd02..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemProviderC") { - hap_name = "FormSystemProviderC" - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/Test.json deleted file mode 100644 index ba2697bb640e6f7c293aa11a828cdc3d4836958b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json deleted file mode 100644 index fc493c12bf5103ff6029963635928a9d4627fe5b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemproviderc", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemproviderc", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "form_module_c", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "launchType": "standard", - "formsEnabled": true, - "forms": [ - { - "name": "FormC_Js001", - "description": "form_description_FormC_Js001", - "descriptionId": 30, - "isDefault": true, - "type": "JS", - "colorMode": "light", - "supportDimensions": [ - "2*4", - "4*4" - ], - "defaultDimension": "2*4", - "updateEnabled": true, - "updateDuration": 4, - "scheduledUpdateTime": "15:30", - "jsComponentName": "card_c", - "formVisibleNotify": true, - "formConfigAbility": "abilityc", - "metaData": { - "customizeData": [ - { - "name": "originWidgetNameC", - "value": "valueC" - } - ] - } - } - ] - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 351831bdb3d18b2e073b144ce1e0dee11d420ff6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info(`[FormProviderC] Application onCreate`); - }, - onDestroy() { - console.info(`[FormProviderC] Application onDestroy`); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 85c1aabd8257bfacd4998ffb38b1092621f1cc9c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,62 +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 featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormProviderC`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`Fms Main Ability Test`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/BUILD.gn deleted file mode 100644 index 72166fbfcfb02dd26af7b418e6ad7e20574f1a91..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/BUILD.gn +++ /dev/null @@ -1,32 +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("FormSystemProviderD") { - hap_name = "FormSystemProviderD" - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/Test.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/Test.json deleted file mode 100644 index ba2697bb640e6f7c293aa11a828cdc3d4836958b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json deleted file mode 100644 index b1f13b2f190231338ca22f5b61ff79e7b19f8eca..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsystemproviderd", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsystemproviderd", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "form_module_d", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "service", - "launchType": "standard", - "formsEnabled": true, - "forms": [] - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 67d9addd8e9501d740d98e6e27e33840011d0c0b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info(`[FormProviderD] Application onCreate`); - }, - onDestroy() { - console.info(`[FormProviderD] Application onDestroy`); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 7521971f569b806dced6a3fff11b68af247a8321..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,62 +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 featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormProviderD`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`Fms Main Ability Test`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/BUILD.gn deleted file mode 100644 index c7564074f34966c611455769c83aebe1291ececc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormAcquireTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormAcquireTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/Test.json deleted file mode 100644 index 6acc04ea494f7a72e7eb635c970f61aeb859a024..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/Test.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formacquiretest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormAcquireTest.hap", - "FormSystemHost.hap", - "FormSystemHostB.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap", - "FormSupplyAppE.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 2d7dedf235ac93bb26e6694eb65700ad939725aa..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 40000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets deleted file mode 100644 index 9e91f296c401dda06f14c45b7a0a8ab9ffb9925c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets +++ /dev/null @@ -1,1565 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onErrorForm_Event = { - events: ["FMS_FormOnError_commonEvent"], -}; -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; -var subscriberFormCastEvent = { - events: ["FMS_FormCast_commonEvent"], -}; -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnError; -var subscriberOnAcquired; -var subscriberCast; -var subscriberSupply; - -export default function test() { - describe(`FmsAcquiredFormTest`, () => { - - beforeEach(async () => { - subscriberOnError = await commonEvent.createSubscriber(onErrorForm_Event); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberCast = await commonEvent.createSubscriber(subscriberFormCastEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }) - - /** - * @tc.number: FMS_acquireForm_0200 - * @tc.name: The form host does not have permission to use the form - * @tc.desc: Failed to create a form when verifying that the form host does not have form permission. - */ - it(`FMS_acquireForm_0200`, 0, async (done) => { - console.info(`FMS_acquireForm_0200 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_0200 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("check permission deny, need to request ohos.permission.REQUIRE_FORM."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0200")); - console.info(`FMS_acquireForm_0200 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_0200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_0200 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_0300 - * @tc.name: Failed to add form when parameter formId is wrong. - * @tc.desc: Failed to create form when verifying that the parameter (formId) of creating form is wrong. - */ - it(`FMS_acquireForm_0300`, 0, async (done) => { - console.info(`FMS_acquireForm_0300 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_0300 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0300")); - console.info(`FMS_acquireForm_0300 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "-1", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_0400 - * @tc.name: Failed to add form when parameter bundlename is wrong. - * @tc.desc: Form creation failed when verifying the wrong parameter (bundlename) of form creation. - */ - it(`FMS_acquireForm_0400`, 0, async (done) => { - console.info(`FMS_acquireForm_0400 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_0400 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0400")); - console.info(`FMS_acquireForm_0400 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "-1", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice123", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_0500 - * @tc.name: Failed to add form when parameter moduleName is wrong. - * @tc.desc: Form creation failed when verifying the wrong parameter (moduleName) of form creation. - */ - it(`FMS_acquireForm_0500`, 0, async (done) => { - console.info(`FMS_acquireForm_0500 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_0500 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0500")); - console.info(`FMS_acquireForm_0500 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "-1", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry123", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_0600 - * @tc.name: Failed to add form when parameter formName is wrong. - * @tc.desc: Form creation failed when verifying the wrong parameter (formName) of form creation. - */ - it(`FMS_acquireForm_0600`, 0, async (done) => { - console.info(`FMS_acquireForm_0600 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_0600 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0600")); - console.info(`FMS_acquireForm_0600 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "-1", - "name": "Form_Js001987", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_0600 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_0700 - * @tc.name: Failed to add form when parameter abilityName is wrong. - * @tc.desc: Form creation failed when verifying the wrong parameter (abilityName) of form creation. - */ - it(`FMS_acquireForm_0700`, 0, async (done) => { - console.info(`FMS_acquireForm_0700 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_0700 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0700")); - console.info(`FMS_acquireForm_0700 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_0700 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "-1", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility123", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_0700 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_1000 - * @tc.name: Failed to add form when parameter form dimension is wrong. - * @tc.desc: Form creation failed when verifying the wrong parameter (form dimension) of form creation. - */ - it(`FMS_acquireForm_1000`, 0, async (done) => { - console.info(`FMS_acquireForm_1000 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1000 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_1000")); - console.info(`FMS_acquireForm_1000 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_1000 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "-1", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "dimension": 4, - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1000 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_1100 - * @tc.name: When the formId is set to 0, a non cached form is added. - * @tc.desc: Verify that the non cache form can be successfully created. - */ - it(`FMS_acquireForm_1100`, 0, async (done) => { - console.info(`FMS_acquireForm_1100 start`); - let formId1; - let formId2; - - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1100 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1100")); - formId1 = data.data; - - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1100", done)); - } - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onCreate") { - console.info("====>FMS_acquireForm_1100 onSupplyCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1100")); - let retData = JSON.parse(data.parameters.parameters); - - let bundleName = retData.bundleName; - expect(bundleName).assertEqual("com.form.formsystemtestservicea.hmservice"); - let abilityName = retData.abilityName; - expect(abilityName).assertEqual("com.form.formsystemtestservicea.hmservice.FormAbility"); - let moduleName = retData.parameters['ohos.extra.param.key.module_name']; - expect(moduleName).assertEqual("entry"); - let formName = retData.parameters['ohos.extra.param.key.form_name']; - expect(formName).assertEqual("Form_Js001"); - let formDimension = retData.parameters['ohos.extra.param.key.form_dimension']; - expect(formDimension).assertEqual(1); - let tempFormFlag = retData.parameters['ohos.extra.param.key.form_temporary']; - expect(tempFormFlag).assertEqual(false); - - formId2 = retData.parameters['ohos.extra.param.key.form_identity']; - - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1100", done)); - } - } - } - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.info(`FMS_acquireForm_1100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1100 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_1200 - * @tc.name: When the formId is set to 0, a non cached form is added. - * @tc.desc: Verify that the non cache form can be successfully created. - */ - it(`FMS_acquireForm_1200`, 0, async (done) => { - console.info(`FMS_acquireForm_1200 start`); - let formId1; - let formId2; - - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1200 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1200")) - formId1 = data.data; - console.info("!!!====>FMS_acquireForm_1200 onAcquiredCallBack formId1:====>" + formId1); - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1200", done)); - } - } - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onCreate") { - console.info("====>FMS_acquireForm_1200 onSupplyCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1200")); - let retData = JSON.parse(data.parameters.parameters); - - let bundleName = retData.bundleName; - expect(bundleName).assertEqual("com.form.formsystemtestservicee.hmservice"); - let abilityName = retData.abilityName; - expect(abilityName).assertEqual("com.form.formsystemtestservicee.hmservice.FormAbility"); - let moduleName = retData.parameters['ohos.extra.param.key.module_name']; - expect(moduleName).assertEqual("entry"); - let formName = retData.parameters['ohos.extra.param.key.form_name']; - expect(formName).assertEqual("Form_Js001"); - let formDimension = retData.parameters['ohos.extra.param.key.form_dimension']; - expect(formDimension).assertEqual(1); - let tempFormFlag = retData.parameters['ohos.extra.param.key.form_temporary']; - expect(tempFormFlag).assertEqual(false); - - formId2 = retData.parameters['ohos.extra.param.key.form_identity']; - console.info("!!!====>FMS_acquireForm_1200 onSupplyCallBack formId2:====>" + formId2); - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1200", done)); - } - } - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.info(`FMS_acquireForm_1200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostb", - abilityName: "com.ohos.st.formsystemhostb.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicee.hmservice", - "ability": "com.form.formsystemtestservicee.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1200 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_1400 - * @tc.name: FormId does not match other parameters when adding a cached form. - * @tc.desc: Failed to create a cached form when verifying that FormId does not match other parameters. - */ - it(`FMS_acquireForm_1400`, 0, async (done) => { - console.info(`FMS_acquireForm_1400 start`); - var formId; - - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1400 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("the requested form id is not existed on fms."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallBackCache("FMS_acquireForm_1400")); - var commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1400", done)); - } - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1400 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1400")) - formId = data.data; - // add cache form - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_1400 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "1", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1400 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.info(`FMS_acquireForm_1400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_1500 - * @tc.name: Add a cached form. - * @tc.desc: Verify that the cached form can be successfully created. - */ - it(`FMS_acquireForm_1500`, 0, async (done) => { - console.info(`FMS_acquireForm_1500 start`); - let formId1; - let formId2; - let onCreateCount = 0; - - function onAcquiredCallBackCache(_, data) { - console.info("!!!====>FMS_acquireForm_1500 onAcquiredCallBackCache data:====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallBackCache("FMS_acquireForm_1500")); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - formId2 = data.data; - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1500", done)); - } - } - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1500 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1500")) - formId1 = data.data; - // add cache form - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBackCache); - console.info(`FMS_acquireForm_1500 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostb", - abilityName: "com.ohos.st.formsystemhostb.MainAbility", - parameters: { - "formId": formId1, - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1500 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onCreate") { - console.info("====>FMS_acquireForm_1500 onSupplyCallBack====>" + JSON.stringify(data)); - onCreateCount++; - if (onCreateCount == 2) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1500")) - } - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1500", done)); - } - } - } - - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.info(`FMS_acquireForm_1500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_1500 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_1600 - * @tc.name: A single form host (using a single thread) continuously creates 2 normal and 2 temporary forms. - * @tc.desc: Verify that a single host (using a single thread) can successfully create multiple normal - * and temporary forms continuously. - */ - it(`FMS_acquireForm_1600`, 0, async (done) => { - console.info(`FMS_acquireForm_1600 start`); - - function delPublishCallBack_Normal1() { - console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Normal1====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1600 delPublishCallBack_Normal1 end'); - FMS_acquireForm_1600_normal2(); - }, 50); - } - function onAcquiredCallBack_Normal1(_, data) { - console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhost", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal1); - } - function unSubscribeOnAcquiredCallBack_Normal1() { - console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"); - } - - async function FMS_acquireForm_1600_normal1() { - console.info(`FMS_acquireForm_1600_normal1 start`); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); - console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1600_normal1 end`); - } - - function delPublishCallBack_Normal2() { - console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Normal2====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1600 delPublishCallBack_Normal2 end'); - FMS_acquireForm_1600_Temp1(); - }, 50); - } - function onAcquiredCallBack_Normal2(_, data) { - console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhost", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal2); - } - function unSubscribeOnAcquiredCallBack_Normal2() { - console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Normal2====>"); - } - async function FMS_acquireForm_1600_normal2() { - console.info(`FMS_acquireForm_1600_normal2 start`); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); - console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1600_normal2 end`); - } - - function delPublishCallBack_Temp1() { - console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Temp1====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1600 delPublishCallBack_Temp1 end'); - FMS_acquireForm_1600_Temp2(); - }, 50); - } - function onAcquiredCallBack_Temp1(_, data) { - console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Temp1 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp1) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhost", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp1); - } - function unSubscribeOnAcquiredCallBack_Temp1() { - console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Temp1====>"); - } - - async function FMS_acquireForm_1600_Temp1() { - console.info(`FMS_acquireForm_1600_Temp1 start`); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp1); - console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1600_Temp1 end`); - } - - function delPublishCallBack_Temp2() { - console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Temp2====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1600 delPublishCallBack_Temp2 end'); - console.info(`FMS_acquireForm_1600 end`); - done(); - }, 500); - } - function onAcquiredCallBack_Temp2(_, data) { - console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Temp2 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp2) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhost", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp2); - } - function unSubscribeOnAcquiredCallBack_Temp2() { - console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Temp2====>"); - } - - async function FMS_acquireForm_1600_Temp2() { - console.info(`FMS_acquireForm_1600_Temp2 start`); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp2); - console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1600_Temp2 end`); - } - - FMS_acquireForm_1600_normal1(); - }); - /** - * @tc.number: FMS_acquireForm_1800 - * @tc.name: Multiple form hosts create one normal form and one temporary form respectively. - * @tc.desc: Verify that multiple hosts can successfully create multiple normal and temporary forms respectively. - */ - it(`FMS_acquireForm_1800`, 0, async (done) => { - console.info(`FMS_acquireForm_1800 start`); - - function delPublishCallBack_Normal1() { - console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Normal1====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1800 delPublishCallBack_Normal1 end'); - FMS_acquireForm_1800_normal2(); - }, 50); - } - function onAcquiredCallBack_Normal1(_, data) { - console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhost", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal1); - } - function unSubscribeOnAcquiredCallBack_Normal1() { - console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"); - } - - async function FMS_acquireForm_1800_normal1() { - console.info(`FMS_acquireForm_1800_normal1 start`); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); - - console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1800_normal1 end`); - } - - function delPublishCallBack_Normal2() { - console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Normal2====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1800 delPublishCallBack_Normal2 end'); - FMS_acquireForm_1800_Temp1(); - }, 50); - } - function onAcquiredCallBack_Normal2(_, data) { - console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostb", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal2); - } - function unSubscribeOnAcquiredCallBack_Normal2() { - console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Normal2====>"); - } - async function FMS_acquireForm_1800_normal2() { - console.info(`FMS_acquireForm_1800_normal2 start`); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); - - console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostb", - abilityName: "com.ohos.st.formsystemhostb.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1800_normal2 end`); - } - - function delPublishCallBack_Temp1() { - console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Temp1====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1800 delPublishCallBack_Temp1 end'); - FMS_acquireForm_1800_Temp2(); - }, 50); - } - function onAcquiredCallBack_Temp1(_, data) { - console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Temp1 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp1) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhost", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp1); - } - function unSubscribeOnAcquiredCallBack_Temp1() { - console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Temp1====>"); - } - - async function FMS_acquireForm_1800_Temp1() { - console.info(`FMS_acquireForm_1800_Temp1 start`); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp1); - console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1800_Temp1 end`); - } - - function delPublishCallBack_Temp2() { - console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Temp2====>"); - setTimeout(function () { - console.info('FMS_acquireForm_1800 delPublishCallBack_Temp2 end'); - console.info(`FMS_acquireForm_1800 end`); - done(); - }, 500); - } - function onAcquiredCallBack_Temp2(_, data) { - console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Temp2 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp2) - var commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostb", - data: data.data - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp2); - } - function unSubscribeOnAcquiredCallBack_Temp2() { - console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Temp2====>"); - } - - async function FMS_acquireForm_1800_Temp2() { - console.info(`FMS_acquireForm_1800_Temp2 start`); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp2); - - console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostb", - abilityName: "com.ohos.st.formsystemhostb.MainAbility", - - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbility end`); - console.info(`FMS_acquireForm_1800_Temp2 end`); - } - - FMS_acquireForm_1800_normal1(); - }); - /** - * @tc.number: FMS_acquireForm_1900 - * @tc.name: Add a temporary form when the formId is set to 0. - * @tc.desc: When the verification formId is set to 0, the temporary form is created successfully. - */ - it(`FMS_acquireForm_1900`, 0, async (done) => { - console.info(`FMS_acquireForm_1900 start`); - let formId1; - let formId2; - - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_1900 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1900")) - formId1 = data.data; - - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1900", done)); - } - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onCreate") { - console.info("====>FMS_acquireForm_1900 onSupplyCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1900")); - let retData = JSON.parse(data.parameters.parameters); - - let bundleName = retData.bundleName; - expect(bundleName).assertEqual("com.form.formsystemtestservicea.hmservice"); - let abilityName = retData.abilityName; - expect(abilityName).assertEqual("com.form.formsystemtestservicea.hmservice.FormAbility"); - let moduleName = retData.parameters['ohos.extra.param.key.module_name']; - expect(moduleName).assertEqual("entry"); - let formName = retData.parameters['ohos.extra.param.key.form_name']; - expect(formName).assertEqual("Form_Js001"); - let formDimension = retData.parameters['ohos.extra.param.key.form_dimension']; - expect(formDimension).assertEqual(1); - let tempFormFlag = retData.parameters['ohos.extra.param.key.form_temporary']; - expect(tempFormFlag).assertEqual(true); - formId2 = retData.parameters['ohos.extra.param.key.form_identity']; - console.info("!!!====>FMS_acquireForm_1900 onAcquiredCallBack formId2:====>" + formId2); - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_1900", done)); - } - } - } - - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - - console.info(`FMS_acquireForm_1900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_1900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_1900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_1900 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_2100 - * @tc.name: When creating a temporary form, the formId is specified as the created normal formId. - * @tc.desc: Failed to create a temporary form when verifying that the formId is set to create a normal formId. - */ - it(`FMS_acquireForm_2100`, 0, async (done) => { - console.info(`FMS_acquireForm_2100 start`); - var formId; - - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2100 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallBackCache("FMS_acquireForm_2100")); - var commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2100", done)); - } - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2100 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2100")) - formId = data.data; - // add cache form - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_2100 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": data.data, - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2100 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.info(`FMS_acquireForm_2100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2100 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_2200 - * @tc.name: Cast to normal form when the temporary formId is set to negative. - * @tc.desc: Failed to Cast to normal form when the temporary formId is set to negative - */ - it(`FMS_acquireForm_2200`, 0, async (done) => { - console.info(`FMS_acquireForm_2200 start`); - - function onCastCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2200 onCastCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2200")) - var commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2200", done)); - } - - commonEvent.subscribe(subscriberCast, onCastCallBack); - console.info(`FMS_acquireForm_2200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "temporaryId": "-1", - "castForm": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2200 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_2300 - * @tc.name: Cast to normal form when the temporary formIdis set to 0. - * @tc.desc: Failed to convert to normal form when verifying that the temporary formIdis set to 0 - */ - it(`FMS_acquireForm_2300`, 0, async (done) => { - console.info(`FMS_acquireForm_2300 start`); - - function onCastCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2300 onCastCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2300")) - var commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2300", done)); - } - commonEvent.subscribe(subscriberCast, onCastCallBack); - console.info(`FMS_acquireForm_2300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "temporaryId": "0", - "castForm": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_2400 - * @tc.name: Non affiliated temporary form ID to normal form. - * @tc.desc: Failed to convert non affiliated temporary form ID to normal form. - */ - it(`FMS_acquireForm_2400`, 0, async (done) => { - console.info(`FMS_acquireForm_2400 start`); - - function onCastCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2400 onCastCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2400")) - var commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2400", done)); - } - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2400 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2400")) - commonEvent.subscribe(subscriberCast, onCastCallBack); - console.info(`FMS_acquireForm_2400 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostb", - abilityName: "com.ohos.st.formsystemhostb.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "temporaryId": data.data, - "castForm": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2400 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.info(`FMS_acquireForm_2400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_2500 - * @tc.name: cast non-existent temporary formId to normal form. - * @tc.desc: Failed to verify that the temporary formId that does not exist is casted to normal form. - */ - it(`FMS_acquireForm_2500`, 0, async (done) => { - console.info(`FMS_acquireForm_2500 start`); - - function onCastCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2500 onCastCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2500")) - var commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2500", done)); - } - commonEvent.subscribe(subscriberCast, onCastCallBack); - console.info(`FMS_acquireForm_2500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "temporaryId": "123456789", - "castForm": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_2600 - * @tc.name: When the normal form does not reach the maximum value created by the form, the temporary form changes to the normal form. - * @tc.desc: Verify that when the normal form does not reach the maximum value created by the form. - * the temporary form can be successfully casted to the normal form. - */ - it(`FMS_acquireForm_2600`, 0, async (done) => { - console.info(`FMS_acquireForm_2600 start`); - let formId1; - let formId2; - - function onCastCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2600 onCastCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2600")) - formId1 = data.parameters.formId; - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2600", done)); - } - } - - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_2600 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2600")) - - console.info(`FMS_acquireForm_2600 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "temporaryId": data.data, - "castForm": true, - "isCreate": false - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2600 featureAbility.startAbility again end`); - } - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onCastToNormal") { - console.info("====>FMS_acquireForm_2600 onSupplyCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_2600")); - formId2 = data.parameters.parameters; - - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_2600", done)); - } - } - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - commonEvent.subscribe(subscriberCast, onCastCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - - console.info(`FMS_acquireForm_2600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": true, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_2600 featureAbility.startAbility end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallBack = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnErrorCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnErrorCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`====>${tcNumber} unSubscribeOnAcquiredCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.info(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} - -const unsubscribeOnErrorCallBackCache = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnErrorCallBackCache CallBack====>`); -} - -const unsubscribeOnAcquiredCallBackCache = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnAcquiredCallBackCache CallBack====>`); -} - -const unsubscribeOnCastCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnCastCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/BUILD.gn deleted file mode 100644 index bfa63f3db8bda2875e5b6d695ca620b22f697299..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/BUILD.gn +++ /dev/null @@ -1,32 +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("FormAcquireTest2") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormAcquireTest2" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/Test.json deleted file mode 100644 index cc064c0aaa28622de5af0d2c9ad7843de085a7cc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/Test.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formacquiretest2", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormAcquireTest2.hap", - "FormSystemHost.hap", - "FormSystemHostI.hap", - "FormSystemHostJ.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json deleted file mode 100644 index 1b87c0033c03042a6c340ba507577eae41c206c9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formacquiretest2", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formacquiretest2", - "name": ".FormAcquire2STApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormCast_commonEvent", - "reason": "need use castFrom commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index d14aada15706ea711e0ca80b2b3d6387bed6fe1f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 40000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets deleted file mode 100644 index 7d3c1489809096afd0821a9b94fe7a3b15d4d8cb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets +++ /dev/null @@ -1,495 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onErrorForm_Event = { - events: ["FMS_FormOnError_commonEvent"], -}; -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; -var subscriberFormCastEvent = { - events: ["FMS_FormCast_commonEvent"], -}; -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnError; -var subscriberOnAcquired; -var subscriberCast; -var subscriberSupply; - -export default function test() { - describe(`FmsAcquiredFormTest2`, () => { - - beforeEach(async () => { - subscriberOnError = await commonEvent.createSubscriber(onErrorForm_Event); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberCast = await commonEvent.createSubscriber(subscriberFormCastEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - }) - - /** - * @tc.number: FMS_acquireForm_3800 - * @tc.name: Failed to add form when parameter ability is wrong. - * @tc.desc: Failed to create form when verifying that the parameter (formId) of creating form is wrong. - */ - it(`FMS_acquireForm_3800`, 0, async (done) => { - console.info(`FMS_acquireForm_3800 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_3800 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_3800")); - console.info(`FMS_acquireForm_3800 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_3800 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_3800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_3800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_3800 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_acquireForm_3900 - * @tc.name: Failed to add form when parameter bundleName is wrong. - * @tc.desc: Failed to create form when verifying that the parameter (bundleName) of creating form is wrong. - */ - it(`FMS_acquireForm_3900`, 0, async (done) => { - console.info(`FMS_acquireForm_3900 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_3900 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_3900")); - console.info(`FMS_acquireForm_3900 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_3900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_3900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_3900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_3900 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_4000 - * @tc.name: When the form specifications are inconsistent, creating the cached form fails. - * @tc.desc: Return failed. - */ - it(`FMS_acquireForm_4000`, 0, async (done) => { - console.info(`FMS_acquireForm_4000 start`); - var formId; - - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4000 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4000")); - expect(data.data).assertEqual("the form id and form config are not matched."); - - console.info(`FMS_acquireForm_4000 end`); - var commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_4000", done)); - } - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4000 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4000")) - formId = data.data; - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - - console.info(`FMS_acquireForm_4000 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": data.data, - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "dimension": "2", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4000 featureAbility.startAbility again end`); - } - function unSubscribeOnAcquiredCallback() { - console.info("====>FMS_acquireForm_4000 OnAcquired UnSubscribe CallBack====>"); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.info(`FMS_acquireForm_4000 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "dimension": "1", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4000 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_4100 - * @tc.name: Failed to add form when parameter moduleName is wrong. - * @tc.desc: Failed to create form when verifying that the parameter (moduleName) of creating form is wrong. - */ - it(`FMS_acquireForm_4100`, 0, async (done) => { - console.info(`FMS_acquireForm_4100 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4100 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4100")); - console.info(`FMS_acquireForm_4100 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_4100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostj", - abilityName: "com.ohos.st.formsystemhostj.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4100 featureAbility.startAbility end`); - }); - - - /** - * @tc.number: FMS_acquireForm_4200 - * @tc.name: Success to add form when parameter formName is blank. - * @tc.desc: Success to create form when verifying that the parameter (formName) of creating form is success. - */ - it(`FMS_acquireForm_4200`, 0, async (done) => { - console.info(`FMS_acquireForm_4200 start`); - let formId1; - let formId2; - - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4200 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4200")) - formId1 = data.data; - - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_4200", done)); - } - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onCreate") { - console.info("====>FMS_acquireForm_4200 onSupplyCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_4200")); - let retData = JSON.parse(data.parameters.parameters); - - let formName = retData.parameters['ohos.extra.param.key.form_name']; - expect(formName).assertEqual("Form_Js001"); - formId2 = retData.parameters['ohos.extra.param.key.form_identity']; - console.info("!!!====>FMS_acquireForm_4200 onAcquiredCallBack formId2:====>" + formId2); - if (formId1 && formId2) { - expect(formId1).assertEqual(formId2); - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_4200", done)); - } - } - } - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.info(`FMS_acquireForm_4200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.info(`FMS_acquireForm_4200 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_4300 - * @tc.name: Success to add form when parameter dimension is passed. - * @tc.desc: Success to create form when verifying that the parameter (dimension) of creating form. - */ - it(`FMS_acquireForm_4300`, 0, async (done) => { - console.info(`FMS_acquireForm_4300 start`); - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4300 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4300")); - console.info(`FMS_acquireForm_4300 end`); - done(); - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.info(`FMS_acquireForm_4300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhosti", - abilityName: "com.ohos.st.formsystemhosti.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4300 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_4400 - * @tc.name: Failed to add form when parameter dimension is not exist. - * @tc.desc: Failed to create form when verifying that the parameter (dimension) of creating form is wrong. - */ - it(`FMS_acquireForm_4400`, 0, async (done) => { - console.info(`FMS_acquireForm_4400 start`); - function onErrorCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4400 onErrorCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4400")); - expect(data.data).assertEqual("the dimension not exist in the form."); - console.info(`FMS_acquireForm_4400 end`); - done(); - } - commonEvent.subscribe(subscriberOnError, onErrorCallBack); - console.info(`FMS_acquireForm_4400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhosti", - abilityName: "com.ohos.st.formsystemhosti.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "dimension": "6", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4400 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_acquireForm_4900 - * @tc.name: Cast temp form when the formId is created formId. - * @tc.desc: When the verification formId is set to 0, the form is created failed. - */ - it(`FMS_acquireForm_4900`, 0, async (done) => { - console.info(`FMS_acquireForm_4900 start`); - - function onCastCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4900 onCastCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data).assertEqual("9"); - commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_4900")) - var commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_acquireForm_4900", done)); - } - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_acquireForm_4900 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4900")) - commonEvent.subscribe(subscriberCast, onCastCallBack); - - console.info(`FMS_acquireForm_4900 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "temporaryId": data.data, - "castForm": true, - "isCreate": false - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4900 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.info(`FMS_acquireForm_4900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhost", - abilityName: "com.ohos.st.formsystemhost.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicea.hmservice", - "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`FMS_acquireForm_4900 featureAbility.startAbility end`); - }); - - }); -} - - -const delPublishCallBack = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnErrorCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnErrorCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`====>${tcNumber} unSubscribeOnAcquiredCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.info(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} - -const unsubscribeOnCastCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnCastCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 3c27a80d1372a250a7948748d1204fa62591f7d0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsAcquireForm2.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/element/string.json deleted file mode 100644 index bc47049debb9999f8680ebda66323e5c9adb4d82..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formacquiretest2" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/BUILD.gn deleted file mode 100644 index e4a3864329792c682b45e898361ddfae16af8aed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormDeleteTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormDeleteTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json deleted file mode 100644 index c0684c33d0357bf2c85ba6d6dd3dd1c76d74246c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formdeletetest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormDeleteTest.hap", - "FormSystemHostC.hap", - "FormSystemHostD.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap", - "FormSupplyAppB.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 0102eeeb97c14545579942cc5d4cf0c745771a67..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 10000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets deleted file mode 100644 index 988882982a25672d22398f92393cf68e5ad63eb7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets +++ /dev/null @@ -1,1168 +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 featureAbility from '@ohos.ability.featureAbility'; -import commonEvent from '@ohos.commonEvent'; -import { setTime } from '@ohos.systemTime'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index.ets'; - -const onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; -const onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; -const onReleasedFormEvent = { - events: ["FMS_FormOnReleased_commonEvent"], -}; -const onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -const deleteForm_Event = "FMS_FormDelete_commonEvent"; - -let subscriberOnAcquired; -let subscriberOnReleased; -let subscriberOnDeleted; -let subscriberSupply; - -export default function test() { - describe(`FmsDeleteFormTest`, () => { - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); - subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }); - - /** - * @tc.number: FMS_deleteForm_0200 - * @tc.name: host does not have permission - * @tc.desc: 1.delete the form that formID is 1 - * 2.Verify the result is false - */ - it(`FMS_deleteForm_0200`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0200`; - let formId; - - const onDeletedCallback = async (_, data) => { - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); - const commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: formId, - isCreate: false - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0300 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.delete the form - * 2.Verify the result is false - */ - it(`FMS_deleteForm_0300`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0300`; - - const onDeletedCallback = async (_, data) => { - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); - const commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: "-1", - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0400 - * @tc.name: formID id is error(formID = 0) - * @tc.desc: 1.delete the form - * 2.Verify the result is false - */ - it(`FMS_deleteForm_0400`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0400`; - - const onDeletedCallback = async (_, data) => { - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); - const commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: "0", - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0500 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.host A create a formA - * 2.host B delete the formA - * 2.Verify the result is false - */ - it(`FMS_deleteForm_0500`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0500`; - let formId; - - const onDeletedCallback = async (_, data) => { - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); - const commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: formId, - isCreate: false - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0600 - * @tc.name: Delete a normal form and the form reference is not 0 after deletion - * @tc.desc: 1.host A create a normal formA - * 2.host B create a form with formA's ID - * 3.delete formA, and verify the result is true - */ - it(`FMS_deleteForm_0600`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0600`; - let formId; - let supplyFlag = false; - - async function delPublishCallback() { - console.info(`${tcNumber} delPublishCallback`); - await sleep(1000); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - if (supplyFlag) { - deleteFormB(); - expect().assertFail(); - } else { - deleteFormB(); - } - console.info(`${tcNumber} delPublishCallback end`); - } - - async function delPublishCallbackB() { - console.info(`${tcNumber} delPublishCallbackB`); - await sleep(500); - console.info(`${tcNumber} delPublishCallbackB end`); - console.info(`${tcNumber} end`); - done(); - } - - function deleteFormB() { - console.info(`${tcNumber} deleteFormB start`); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostd", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); - console.info(`${tcNumber} deleteFormB end`); - } - - const onAcquiredCallbackB = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - expect(data.data).assertEqual(formId); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - }; - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - await sleep(1000); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - formId: formId, - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - const onSupplyCallback = async (_, data) => { - if (data.parameters.kind == "onDestroy") { - console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); - supplyFlag = true; - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0700 - * @tc.name: After deleting a normal form, the form reference is 0. - * After deleting a form, there are still created normal forms in FMS. - * @tc.desc: 1.host A an host B create one normal card respectively - * 2.host A delete the form and verify the result is true - */ - it(`FMS_deleteForm_0700`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0700`; - let formId; - let formIdB; - let supplyFlag = false; - - async function delPublishCallback() { - console.info(`${tcNumber} delPublishCallback`); - await sleep(1000); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - if (supplyFlag) { - deleteFormB(); - } else { - deleteFormB(); - expect().assertFail(); - } - console.info(`${tcNumber} delPublishCallback end`); - } - - async function delPublishCallbackB() { - console.info(`${tcNumber} delPublishCallbackB`); - await sleep(1000); - console.info(`${tcNumber} delPublishCallbackB end`); - console.info(`${tcNumber} end`); - done(); - } - - function deleteFormB() { - console.info(`${tcNumber} deleteFormB start`); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostd", - data: formIdB - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); - console.info(`${tcNumber} deleteFormB end`); - } - - const onAcquiredCallbackB = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - formIdB = data.data; - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - }; - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - await sleep(1000); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - const onSupplyCallback = async (_, data) => { - if (data.parameters.kind == "onDestroy") { - console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); - expect(data.parameters.parameters).assertEqual(formId); - supplyFlag = true; - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0700_1 - * @tc.name: After deleting a normal form, the form reference is 0. - * After deleting a form, there are still created normal forms in FMS. - * @tc.desc: 1.host A an host B create one normal card respectively - * 2.host A delete the form and verify the result is true - */ - it(`FMS_deleteForm_0700_1`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0700_1`; - let formId; - let formIdB; - let supplyFlag = false; - let supplyFlagUpdate = false; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 900 }, () => { - console.info(`${tcNumber} time speed up`); - }); - await changeTime(10, 29, 55); - - async function delPublishCallback() { - console.info(`${tcNumber} delPublishCallback`); - await sleep(5000); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - if (supplyFlag && supplyFlagUpdate) { - deleteFormB(); - } else { - deleteFormB(); - expect().assertFail(); - } - console.info(`${tcNumber} delPublishCallback end`); - } - - async function delPublishCallbackB() { - console.info(`${tcNumber} delPublishCallbackB`); - await sleep(1000); - console.info(`${tcNumber} delPublishCallbackB end`); - console.info(`${tcNumber} end`); - done(); - } - - async function deleteFormB() { - console.info(`${tcNumber} deleteFormB start`); - // timer speed reset - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.info(`${tcNumber} time speed up`); - }); - await sleep(1000); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formIdB - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); - console.info(`${tcNumber} deleteFormB end`); - } - - const onAcquiredCallbackB = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - formIdB = data.data; - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostd", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - }; - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - await sleep(1000); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - const onSupplyCallback = async (_, data) => { - if (data.parameters.kind == "onDestroy") { - console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); - expect(data.parameters.parameters).assertEqual(formId); - supplyFlag = true; - } - if (data.parameters.kind == "onUpdate") { - if (data.parameters.parameters == formId) { - expect().assertFail(); - } else if (data.parameters.parameters == formIdB) { - supplyFlagUpdate = true; - } - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - formId: "0", - name: "Form_Js002", - bundle: "com.form.formsystemtestserviceb.hmservice", - ability: "com.form.formsystemtestserviceb.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0700_2 - * @tc.name: After deleting a normal form, the form reference is 0. - * After deleting a form, there are still created normal forms in FMS. - * @tc.desc: 1.host A an host B create one normal card respectively - * 2.host A delete the form and verify the result is true - */ - it(`FMS_deleteForm_0700_2`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0700_2`; - let formId; - let formIdB; - let supplyFlag = false; - let supplyFlagUpdate = false; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 900 }, () => { - console.info(`${tcNumber} time speed up`); - }); - await changeTime(10, 29, 55); - async function delPublishCallback() { - console.info(`${tcNumber} delPublishCallback`); - await sleep(5000); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - if (supplyFlag && supplyFlagUpdate) { - deleteFormB(); - } else { - deleteFormB(); - expect().assertFail(); - } - console.info(`${tcNumber} delPublishCallback end`); - } - - async function delPublishCallbackB() { - console.info(`${tcNumber} delPublishCallbackB`); - await sleep(1000); - console.info(`${tcNumber} delPublishCallbackB end`); - console.info(`${tcNumber} end`); - done(); - } - - async function deleteFormB() { - console.info(`${tcNumber} deleteFormB start`); - // timer speed reset - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.info(`${tcNumber} time speed up`); - }); - await sleep(1000); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostd", - data: formIdB - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); - console.info(`${tcNumber} deleteFormB end`); - } - - const onAcquiredCallbackB = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - formIdB = data.data; - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - }; - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - await sleep(1000); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - formId: "0", - name: "Form_Js002", - bundle: "com.form.formsystemtestserviceb.hmservice", - ability: "com.form.formsystemtestserviceb.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - const onSupplyCallback = async (_, data) => { - if (data.parameters.kind == "onDestroy") { - console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); - expect(data.parameters.parameters).assertEqual(formId); - supplyFlag = true; - } - if (data.parameters.kind == "onUpdate") { - if (data.parameters.parameters == formId) { - expect().assertFail(); - } else if (data.parameters.parameters == formIdB) { - supplyFlagUpdate = true; - } - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_0900 - * @tc.name: Form ID error (FormID does not exist) - * @tc.desc: 1.host create one normal card - * 2.host delete the form - * 3.host delete the form again and verify the result is false - */ - it(`FMS_deleteForm_0900`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_0900`; - let formId; - - function onDeletedCallback2(_, data) { - console.info(`${tcNumber} onDeletedCallback2 data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data != "0").assertEqual(true); - console.info(`${tcNumber} failed to delete form again.`); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - } - - const onDeletedCallback = async (_, data) => { - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data).assertEqual(`0`); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); - formId = data.parameters.formId; - subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); - await sleep(1000); - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback2); - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: formId, - isCreate: false - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: "self", - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_1000 - * @tc.name: You can delete a card after releasing it - * @tc.desc: 1.host create one normal card - * 2.host release the form - * 3.host delete the form and verify the result is true - */ - it(`FMS_deleteForm_1000`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_1000`; - let formId; - - async function onReleasedCallback(_, data) { - console.info(`${tcNumber} onReleasedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnReleased_commonEvent`); - expect(data.data).assertEqual(`0`); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback(tcNumber)); - formId = data.parameters.formId; - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - deleteId: formId, - isCreate: false - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnReleased, onReleasedCallback); - - const onSupplyCallback = async (_, data) => { - if (data.parameters.kind == "onDestroy") { - console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - expect(data.parameters.parameters).assertEqual(formId); - await sleep(1000); - console.info(`${tcNumber}onDeletedCallback end`); - console.info(`${tcNumber} end`); - done(); - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: false, - "releaseForm": true, - "releaseId": "self", - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_deleteForm_1100 - * @tc.name: When deleting a temporary form, cache data is deleted. - * @tc.desc: 1.host a and b create one temporary card respectively - * 2.host a delete the form and verify the result is true - */ - it(`FMS_deleteForm_1100`, 0, async (done) => { - const tcNumber = `FMS_deleteForm_1100`; - let formId; - let formIdB; - let supplyFlag = false; - - async function delPublishCallback() { - console.info(`${tcNumber} delPublishCallback`); - await sleep(1000); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - if (supplyFlag) { - deleteFormB(); - } else { - deleteFormB(); - expect().assertFail(); - } - console.info(`${tcNumber} delPublishCallback end`); - } - - async function delPublishCallbackB() { - console.info(`${tcNumber} delPublishCallbackB`); - await sleep(1000); - console.info(`${tcNumber} delPublishCallbackB end`); - console.info(`${tcNumber} end`); - done(); - } - - function deleteFormB() { - console.info(`${tcNumber} deleteFormB start`); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostd", - data: formIdB - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); - console.info(`${tcNumber} deleteFormB end`); - } - - const onAcquiredCallbackB = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - formIdB = data.data; - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - }; - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - await sleep(1000); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: true, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - const onSupplyCallback = async (_, data) => { - if (data.parameters.kind == "onDestroy") { - console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); - expect(data.parameters.parameters).assertEqual(formId); - supplyFlag = true; - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.FormAbility", - moduleName: "entry", - temporary: true, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - }); -} - -/** - * Set time - * - * @param hour hour of 24H clock - * @param min minute - * @param second second - */ -const changeTime = async (hour, min, second) => { - console.info(`FMS_deleteForm changeTime start`); - const datetime = new Date(); - const year = datetime.getFullYear(); - const month = datetime.getMonth() + 1; - const day = datetime.getDate(); - const formatTime = year + '-' + fill(month) + '-' + fill(day) - + 'T' + fill(hour) + ':' + fill(min) + ':' + fill(second); - const s = (new Date(formatTime)).getTime(); - console.info(`FMS_deleteForm changeTime formatTime: ${formatTime}`); - console.info(`FMS_deleteForm changeTime s: ${s}`); - - try { - await setTime(s); - console.info(`FMS_deleteForm set time success: ${formatTime}`); - } catch (error) { - console.info(`FMS_deleteForm set time failure: ${error}`); - } - console.info(`FMS_deleteForm changeTime end`); -}; - -const fill = value => { - return (value > 9 ? "" : "0") + value; -}; - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - await sleep(1000); - console.info(`${tcNumber} delPublishCallback end`); - console.info(`${tcNumber} end`); - done(); -}; - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe OnAcquired Callback`); -}; - -const unsubscribeOnDeletedCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe OnDeleted Callback`); -}; - -const unsubscribeSupplyCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe Supply Callback`); -}; - -const unsubscribeOnReleasedCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe OnReleased Callback`); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/BUILD.gn deleted file mode 100644 index adba71b0a55e4aa658dc91048298a30c188c4073..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormDynamicRefreshTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormDynamicRefreshTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/Test.json deleted file mode 100644 index 425b7eb6a86d1b42c1aefbff220cbb0032a1e32a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/Test.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formdynamicrefreshtest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormDynamicRefreshTest.hap", - "FormSystemHostE.hap", - "FormSystemHostF.hap", - "FormSupplyAppA.hap", - "FormSupplyAppC.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 04791d0a0e3385731a98c4fa358e255582f6f587..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,67 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets deleted file mode 100644 index 5e59daae31f49efe032dc359dd4a25095014060b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets +++ /dev/null @@ -1,436 +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 featureAbility from '@ohos.ability.featureAbility'; -import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index.ets'; - -const onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; - -const onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; - -const onRefreshFormEvent = { - events: ["FMS_FormDynamicRefresh_commonEvent"], -}; - -const onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -const deleteForm_Event = "FMS_FormDelete_commonEvent"; - -let subscriberOnAcquired; -let subscriberOnDeleted; -let subscriberOnRefresh; -let subscriberSupply; - -export default function test() { - describe(`FmsTimeRefreshFormTest`, () => { - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberOnRefresh = await commonEvent.createSubscriber(onRefreshFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }); - - /** - * @tc.number: FMS_timedRefresh_0100 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. - * 2.Verify the result of the dynamic timed refresh interface. - */ - it(`FMS_timedRefresh_0100`, 0, async (done) => { - const tcNumber = `FMS_timedRefresh_0100`; - - const onRefreshCallback = async (_, data) => { - console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); - expect(data.data).assertEqual(`7`); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); - const commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - refreshForm: true, - refreshId: "-1", - refreshTime: 5, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_timedRefresh_0200 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. - * 2.Verify the result of the dynamic timed refresh interface. - */ - it(`FMS_timedRefresh_0200`, 0, async (done) => { - const tcNumber = `FMS_timedRefresh_0200`; - - const onRefreshCallback = async (_, data) => { - console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); - expect(data.data).assertEqual(`7`); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); - const commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - refreshForm: true, - refreshId: "0", - refreshTime: 5, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_timedRefresh_0300 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form provider B to invoke the dynamic timed refresh interface. - * 2.Verify the result of the dynamic timed refresh interface. - */ - it(`FMS_timedRefresh_0300`, 0, async (done) => { - const tcNumber = `FMS_timedRefresh_0300`; - let formId; - - const onRefreshCallback = async (_, data) => { - console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); - expect(data.data).assertEqual(`13`); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); - const commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); - - const onAcquiredCallback = async (_, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); - formId = data.data; - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - refreshForm: true, - refreshId: formId, - refreshTime: 5, - isCreate: false - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_timedRefresh_0400 - * @tc.name: Form ID error (FormID does not exist) - * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. - * 2.Verify the result of the dynamic timed refresh interface. - */ - it(`FMS_timedRefresh_0400`, 0, async (done) => { - const tcNumber = `FMS_timedRefresh_0400`; - let formId; - - const onRefreshCallback = async (_, data) => { - console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); - expect(data.data).assertEqual(`9`); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); - const commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); - - const onDeletedCallback = async (_, data) => { - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); - expect(data.data).assertEqual(`0`); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeDeletedCallback(tcNumber)); - formId = data.parameters.formId; - - console.info(`${tcNumber} featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - refreshForm: true, - refreshId: formId, - refreshTime: 5, - isCreate: false - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility again end`); - }; - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - deleteForm: true, - "deleteId": "self", - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_timedRefresh_0500 - * @tc.name: Incorrect interval for the next refresh (time < 5) - * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. - * 2.Verify the result of the dynamic timed refresh interface. - */ - it(`FMS_timedRefresh_0500`, 0, async (done) => { - const tcNumber = `FMS_timedRefresh_0500`; - - const onRefreshCallback = async (_, data) => { - console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); - expect(data.data).assertEqual(`7`); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); - const commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - }; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicea.hmservice", - ability: "com.form.formsystemtestservicea.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - refreshForm: true, - refreshId: "self", - refreshTime: 1, - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_timedRefresh_0600 - * @tc.name: correct interval for the next refresh (time == 5) - * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. - * 2.Verify the result of the dynamic timed refresh interface. - */ - it(`FMS_timedRefresh_0600`, 0, async (done) => { - const tcNumber = `FMS_timedRefresh_0600`; - - const onSupplyCallback = async (_, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}`); - expect(data.event).assertEqual(`FMS_FormSupply_commonEvent`); - if (data.parameters.kind == "onVisibilityChange") { - console.info(`${tcNumber} onSupplyCallback kind: data.parameters.kind`); - console.info(`${tcNumber} onSupplyCallback error: data.parameters.errorData`); - expect(data.parameters.errorData).assertEqual(`0`); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); - const commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback(tcNumber, done)); - } - }; - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - - console.info(`${tcNumber} featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - formId: "0", - name: "Form_Js001", - bundle: "com.form.formsystemtestservicec.hmservice", - ability: "com.form.formsystemtestservicec.hmservice.MainAbility", - moduleName: "entry", - temporary: false, - "notifyVisibleForms": true, - "notifyVisibleId": "self", - isCreate: true - } - } - }).then((res: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.info(`${tcNumber} featureAbility.startAbility end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - await sleep(1000); - console.info(`${tcNumber} delPublishCallback end`); - console.info(`${tcNumber} end`); - done(); -}; - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe OnAcquired Callback`); -}; - -const unsubscribeDeletedCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe Deleted Callback`); -}; - -const unsubscribeSupplyCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe Supply Callback`); -}; - -const unsubscribeOnRefreshCallback = (tcNumber) => { - console.info(`${tcNumber} Unsubscribe OnRefresh Callback`); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/Test.json deleted file mode 100644 index b39f012d0d10e4a3b855a088f57a8b33119a9ac0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "600000", - "package": "com.ohos.st.formfuzztest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormFuzzTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 97f187805ddd3e803b7fc3550e49c8962fd136f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate'); - }, - onDestroy() { - console.info('Application onDestroy'); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 9bdbb9de51e6b9b8287e4ac93376353e45fef020..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,64 +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 featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - private componentName: string = `FormSystemFuzzTest`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`${this.componentName}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/CastTempFormFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/CastTempFormFuzz.test.ets deleted file mode 100644 index f7830aac88877ac7d87776e16c0d05c6f7d4ce80..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/CastTempFormFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const castTempFormFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_casttempform`; - const promiseName = `FMS_fuzzTest_casttempform`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_casttempform_0100 ~ FMS_fuzzTest_casttempform_0800 - * @tc.desc Check whether the castTempForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - try { - formHost.castTempForm(formId, (error, data) => { - console.log(`${callbackName} ${tcNumber} castTempForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_casttempform_0900 ~ FMS_fuzzTest_casttempform_1600 - * @tc.desc Check whether the castTempForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); - try { - const data = await formHost.castTempForm(formId); - console.log(`${promiseName} ${tcNumber} castTempForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DeleteFormFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DeleteFormFuzz.test.ets deleted file mode 100644 index b8b69cd7634cbc929c397002b97de0ae0cb9ddac..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DeleteFormFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const deleteFormFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_deleteform`; - const promiseName = `FMS_fuzzTest_deleteform`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_deleteform_0100 ~ FMS_fuzzTest_deleteform_0800 - * @tc.desc Check whether the deleteForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - try { - formHost.deleteForm(formId, (error, data) => { - console.log(`${callbackName} ${tcNumber} deleteForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_deleteform_0900 ~ FMS_fuzzTest_deleteform_1600 - * @tc.desc Check whether the deleteForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); - try { - const data = await formHost.deleteForm(formId); - console.log(`${promiseName} ${tcNumber} deleteForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DisableFormsUpdateFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DisableFormsUpdateFuzz.test.ets deleted file mode 100644 index fca311941194f99e4bfe1deebdd14c023176f591..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DisableFormsUpdateFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const disableFormsUpdateFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_disable`; - const promiseName = `FMS_fuzzTest_disable`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_disable_0100 ~ FMS_fuzzTest_disable_0800 - * @tc.desc Check whether the disableFormsUpdate interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); - try { - formHost.disableFormsUpdate(formIds, (error, data) => { - console.log(`${callbackName} ${tcNumber} disableFormsUpdate data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_disable_0900 ~ FMS_fuzzTest_disable_1600 - * @tc.desc Check whether the disableFormsUpdate interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); - try { - const data = await formHost.disableFormsUpdate(formIds); - console.log(`${promiseName} ${tcNumber} disableFormsUpdate data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/EnableFormsUpdateFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/EnableFormsUpdateFuzz.test.ets deleted file mode 100644 index 6128e96d1281573042eef7f64cbbb1fe9e748677..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/EnableFormsUpdateFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const enableFormsUpdateFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_enable`; - const promiseName = `FMS_fuzzTest_enable`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_enable_0100 ~ FMS_fuzzTest_enable_0800 - * @tc.desc Check whether the enableFormsUpdate interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); - try { - formHost.enableFormsUpdate(formIds, (error, data) => { - console.log(`${callbackName} ${tcNumber} enableFormsUpdate data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_enable_0900 ~ FMS_fuzzTest_enable_1600 - * @tc.desc Check whether the enableFormsUpdate interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); - try { - const data = await formHost.enableFormsUpdate(formIds); - console.log(`${promiseName} ${tcNumber} enableFormsUpdate data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets deleted file mode 100644 index 4e55c4399d500ae7c2cb53fbe306cd0418cd3f18..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets +++ /dev/null @@ -1,233 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const getFormsInfoFuzzTest = (describeName, filterParameter) => { - const ERR_GET_BUNDLE_FAILED_CODE = 5; - const ERR_GET_BUNDLE_FAILED = `failed to obtain the bundle information`; - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_getinfobundle`; - const promiseName = `FMS_fuzzTest_getinfobundle`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_getinfobundle_0100 ~ FMS_fuzzTest_getinfobundle_0800 - * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const bundleName = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} bundleName typeof: ${typeof bundleName}`); - try { - formHost.getFormsInfo(bundleName, (error, data) => { - console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_getinfobundle_0900 ~ FMS_fuzzTest_getinfobundle_1600 - * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const bundleName = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} bundleName typeof: ${typeof bundleName}`); - try { - const data = await formHost.getFormsInfo(bundleName); - console.log(`${promiseName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - } - }); - } - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_getinfomodule`; - const promiseName = `FMS_fuzzTest_getinfomodule`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_getinfomodule_0100 ~ FMS_fuzzTest_getinfomodule_0800 - * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const bundleName = getFuzzData(dataType); - const moduleName = `com.test.module_name_${tcNumber}`; - console.log(`${callbackName} ${tcNumber} bundleName typeof: ${typeof bundleName}`); - console.log(`${callbackName} ${tcNumber} moduleName typeof: ${typeof moduleName}`); - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_getinfomodule_0900 ~ FMS_fuzzTest_getinfomodule_1600 - * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const bundleName = getFuzzData(dataType); - const moduleName = `com.test.module_name_${tcNumber}`; - console.log(`${promiseName} ${tcNumber} ${describeName} bundleName typeof: ${typeof bundleName}`); - console.log(`${promiseName} ${tcNumber} ${describeName} moduleName typeof: ${typeof moduleName}`); - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 2) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_getinfomodule_1700 ~ FMS_fuzzTest_getinfomodule_2400 - * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const bundleName = `com.test.bundle_name_${tcNumber}`; - const moduleName = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} bundleName typeof: ${typeof bundleName}`); - console.log(`${callbackName} ${tcNumber} moduleName typeof: ${typeof moduleName}`); - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 3) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_getinfomodule_2500 ~ FMS_fuzzTest_getinfomodule_3200 - * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const bundleName = `com.test.bundle_name_${tcNumber}`; - const moduleName = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} bundleName typeof: ${typeof bundleName}`); - console.log(`${promiseName} ${tcNumber} ${describeName} moduleName typeof: ${typeof moduleName}`); - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - } - }); - } - }) -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index ebefecdb953a9824881c38a0e9df66f8ceaa5ef8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,61 +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 { castTempFormFuzzTest } from './CastTempFormFuzz.test.ets'; -import { deleteFormFuzzTest } from './DeleteFormFuzz.test.ets'; -import { disableFormsUpdateFuzzTest } from './DisableFormsUpdateFuzz.test.ets'; -import { enableFormsUpdateFuzzTest } from './EnableFormsUpdateFuzz.test.ets'; -import { getFormsInfoFuzzTest } from './GetFormsInfoFuzz.test.ets'; -import { notifyInvisibleFormsFuzzTest } from './NotifyInvisibleFormsFuzz.test.ets'; -import { notifyVisibleFormsFuzzTest } from './NotifyVisibleFormsFuzz.test.ets'; -import { releaseFormFuzzTest } from './ReleaseFormFuzz.test.ets'; -import { requestFormFuzzTest } from './RequestFormFuzz.test.ets'; -import { setFormNextRefreshTimeFuzzTest } from './SetFormNextRefreshTimeFuzz.test.ets'; -import { updateFormFuzzTest } from './UpdateFormFuzz.test.ets'; - -export default function testsuite() { - // FMS_fuzzTest_deleteform - deleteFormFuzzTest(`DeleteFormFuzzTest`, 0); - - // FMS_fuzzTest_releaseform - releaseFormFuzzTest(`ReleaseFormFuzzTest`, 0); - - // FMS_fuzzTest_casttempform - castTempFormFuzzTest(`CastTempFormFuzzTest`, 0); - - // FMS_fuzzTest_invisible - notifyVisibleFormsFuzzTest(`NotifyVisibleFormsFuzzTest`, 0); - - // FMS_fuzzTest_visible - notifyInvisibleFormsFuzzTest(`NotifyInvisibleFormsFuzzTest`, 0); - - // FMS_fuzzTest_requestform - requestFormFuzzTest(`RequestFormFuzzTest`, 0); - - // FMS_fuzzTest_updateform - updateFormFuzzTest(`UpdateFormFuzzTest`, 0); - - // FMS_fuzzTest_setnexttime - setFormNextRefreshTimeFuzzTest(`SetFormNextRefreshTimeFuzzTest`, 0); - - // FMS_fuzzTest_enable - enableFormsUpdateFuzzTest(`EnableFormsUpdateFuzzTest`, 0); - - // FMS_fuzzTest_disable - disableFormsUpdateFuzzTest(`DisableFormsUpdateFuzzTest`, 0); - - // FMS_fuzzTest_getinfobundle - // FMS_fuzzTest_getinfomodule - getFormsInfoFuzzTest(`GetFormsInfoFuzzTest`, 0); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyInvisibleFormsFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyInvisibleFormsFuzz.test.ets deleted file mode 100644 index 05306c6bda4112c0f7a06a16c6c286adedeb2cd0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyInvisibleFormsFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const notifyInvisibleFormsFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_invisible`; - const promiseName = `FMS_fuzzTest_invisible`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_invisible_0100 ~ FMS_fuzzTest_invisible_0800 - * @tc.desc Check whether the notifyInvisibleForms interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); - try { - formHost.notifyInvisibleForms(formIds, (error, data) => { - console.log(`${callbackName} ${tcNumber} notifyInvisibleForms data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_invisible_0900 ~ FMS_fuzzTest_invisible_1600 - * @tc.desc Check whether the notifyInvisibleForms interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); - try { - const data = await formHost.notifyInvisibleForms(formIds); - console.log(`${promiseName} ${tcNumber} notifyInvisibleForms data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyVisibleFormsFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyVisibleFormsFuzz.test.ets deleted file mode 100644 index 67d866f30faf4921eb9b19ef68a00c0b1955d8c9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyVisibleFormsFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const notifyVisibleFormsFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_visible`; - const promiseName = `FMS_fuzzTest_visible`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_visible_0100 ~ FMS_fuzzTest_visible_0800 - * @tc.desc Check whether the notifyVisibleForms interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); - try { - formHost.notifyVisibleForms(formIds, (error, data) => { - console.log(`${callbackName} ${tcNumber} notifyVisibleForms data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_visible_0900 ~ FMS_fuzzTest_visible_1600 - * @tc.desc Check whether the notifyVisibleForms interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formIds = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); - try { - const data = await formHost.notifyVisibleForms(formIds); - console.log(`${promiseName} ${tcNumber} notifyVisibleForms data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/ReleaseFormFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/ReleaseFormFuzz.test.ets deleted file mode 100644 index 090daa17659e926eda40cf701c74ce006daf28d8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/ReleaseFormFuzz.test.ets +++ /dev/null @@ -1,218 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const releaseFormFuzzTest = (describeName, filterParameter) => { - const ERR_COMMON_CODE = 1; - const ERR_COMMON = `internal error`; - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - const ERR_NOT_EXIST_ID_CODE = 9; - const ERR_NOT_EXIST_ID = `the ID of the form to be operated does not exist`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_releaseform`; - const promiseName = `FMS_fuzzTest_releaseform`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_releaseform_0100 ~ FMS_fuzzTest_releaseform_0800 - * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - try { - formHost.releaseForm(formId, (error, data) => { - console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_releaseform_0900 ~ FMS_fuzzTest_releaseform_1600 - * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); - try { - const data = await formHost.releaseForm(formId); - console.log(`${promiseName} ${tcNumber} releaseForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 2) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_releaseform_1700 ~ FMS_fuzzTest_releaseform_2400 - * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - const isReleaseCache = true; - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${callbackName} ${tcNumber} isReleaseCache typeof: ${typeof isReleaseCache}`); - try { - formHost.releaseForm(formId, isReleaseCache, (error, data) => { - console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 3) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_releaseform_2500 ~ FMS_fuzzTest_releaseform_3200 - * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - const isReleaseCache = true; - console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); - console.log(`${promiseName} ${tcNumber} ${describeName} isReleaseCache typeof: ${typeof isReleaseCache}`); - try { - const data = await formHost.releaseForm(formId, isReleaseCache); - console.log(`${promiseName} ${tcNumber} releaseForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } else { - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } - done(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 4) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_releaseform_3300 ~ FMS_fuzzTest_releaseform_4000 - * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = `${tcNumber}`; - const isReleaseCache = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${callbackName} ${tcNumber} isReleaseCache typeof: ${typeof isReleaseCache}`); - try { - formHost.releaseForm(formId, isReleaseCache, (error, data) => { - console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - if (`BOOLEAN` === dataType) { - expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE); - expect(error.message).assertEqual(ERR_NOT_EXIST_ID); - } else { - expect(error.code).assertEqual(ERR_COMMON_CODE); - expect(error.message).assertEqual(ERR_COMMON); - } - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 5) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_releaseform_4100 ~ FMS_fuzzTest_releaseform_4800 - * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = `${tcNumber}`; - const isReleaseCache = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); - console.log(`${promiseName} ${tcNumber} ${describeName} isReleaseCache typeof: ${typeof isReleaseCache}`); - try { - const data = await formHost.releaseForm(formId, isReleaseCache); - console.log(`${promiseName} ${tcNumber} releaseForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`BOOLEAN` === dataType) { - expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE); - expect(error.message).assertEqual(ERR_NOT_EXIST_ID); - } else { - expect(error.code).assertEqual(ERR_COMMON_CODE); - expect(error.message).assertEqual(ERR_COMMON); - } - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/RequestFormFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/RequestFormFuzz.test.ets deleted file mode 100644 index e16563005172fc2d15157d8c95f20e7e3b854d57..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/RequestFormFuzz.test.ets +++ /dev/null @@ -1,82 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const requestFormFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_requestform`; - const promiseName = `FMS_fuzzTest_requestform`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_requestform_0100 ~ FMS_fuzzTest_requestform_0800 - * @tc.desc Check whether the requestForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - try { - formHost.requestForm(formId, (error, data) => { - console.log(`${callbackName} ${tcNumber} requestForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_requestform_0900 ~ FMS_fuzzTest_requestform_1600 - * @tc.desc Check whether the requestForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); - try { - const data = await formHost.requestForm(formId); - console.log(`${promiseName} ${tcNumber} requestForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/SetFormNextRefreshTimeFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/SetFormNextRefreshTimeFuzz.test.ets deleted file mode 100644 index 19bb8800436532f2f8cf12ccb140197d67e2e76a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/SetFormNextRefreshTimeFuzz.test.ets +++ /dev/null @@ -1,168 +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 formProvider from '@ohos.application.formProvider'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const setFormNextRefreshTimeFuzzTest = (describeName, filterParameter) => { - const ERR_COMMON_CODE = 1; - const ERR_COMMON = `internal error`; - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - const ERR_NOT_EXIST_ID_CODE = 9; - const ERR_NOT_EXIST_ID = `the ID of the form to be operated does not exist`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_setnexttime`; - const promiseName = `FMS_fuzzTest_setnexttime`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_setnexttime_0100 ~ FMS_fuzzTest_setnexttime_0800 - * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - const nextTime = 5; - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${callbackName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); - try { - formProvider.setFormNextRefreshTime(formId, nextTime, (error, data) => { - console.log(`${callbackName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_setnexttime_0900 ~ FMS_fuzzTest_setnexttime_1600 - * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - const nextTime = 5; - console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${promiseName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); - try { - const data = await formProvider.setFormNextRefreshTime(formId, nextTime); - console.log(`${promiseName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 2) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_setnexttime_1700 ~ FMS_fuzzTest_setnexttime_2400 - * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = `${tcNumber}`; - const nextTime = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${callbackName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); - try { - formProvider.setFormNextRefreshTime(formId, nextTime, (error, data) => { - console.log(`${callbackName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - if (`NUMBER` === dataType) { - if (ERR_NOT_EXIST_ID_CODE === error.code) { - expect(error.message).assertEqual(ERR_NOT_EXIST_ID); - } else if (ERR_ADD_INVALID_PARAM_CODE === error.code) { - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } else { - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - } else { - expect(error.code).assertEqual(ERR_COMMON_CODE); - expect(error.message).assertEqual(ERR_COMMON); - } - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 3) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_setnexttime_2500 ~ FMS_fuzzTest_setnexttime_3200 - * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = `${tcNumber}`; - const nextTime = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${promiseName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); - try { - const data = await formProvider.setFormNextRefreshTime(formId, nextTime); - console.log(`${promiseName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`NUMBER` === dataType) { - if (ERR_NOT_EXIST_ID_CODE === error.code) { - expect(error.message).assertEqual(ERR_NOT_EXIST_ID); - } else if (ERR_ADD_INVALID_PARAM_CODE === error.code) { - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - } else { - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - } else { - expect(error.code).assertEqual(ERR_COMMON_CODE); - expect(error.message).assertEqual(ERR_COMMON); - } - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/UpdateFormFuzz.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/UpdateFormFuzz.test.ets deleted file mode 100644 index 50d26dca9e1161ba033569302d3e28aa626ef8cc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/UpdateFormFuzz.test.ets +++ /dev/null @@ -1,142 +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 formProvider from '@ohos.application.formProvider'; -import { describe, expect, it } from 'deccjsunit/index.ets'; -import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; - -export const updateFormFuzzTest = (describeName, filterParameter) => { - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_updateform`; - const promiseName = `FMS_fuzzTest_updateform`; - const length = DATA_TYPE_LIST.length; - - for (let i = 0; i < length; ++i) { - const tcNumber = `0${(i + 1) * 100}`; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_updateform_0100 ~ FMS_fuzzTest_updateform_0800 - * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - const formBindingData = {}; - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${callbackName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); - try { - formProvider.updateForm(formId, formBindingData, (error, data) => { - console.log(`${callbackName} ${tcNumber} updateForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - let tcNumber: any = (i + 1 + length) * 100; - tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_updateform_0900 ~ FMS_fuzzTest_updateform_1600 - * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = getFuzzData(dataType); - const formBindingData = {}; - console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${promiseName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); - try { - const data = await formProvider.updateForm(formId, formBindingData); - console.log(`${promiseName} ${tcNumber} updateForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 2) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_updateform_1700 ~ FMS_fuzzTest_updateform_2400 - * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by AsyncCallback) - */ - it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = `${tcNumber}`; - const formBindingData = getFuzzData(dataType); - console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${callbackName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); - try { - formProvider.updateForm(formId, formBindingData, (error, data) => { - console.log(`${callbackName} ${tcNumber} updateForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(data).assertUndefined(); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - }); - } catch (error) { - console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - console.log(`${callbackName} ${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - } - - for (let i = 0; i < length; ++i) { - const tcNumber: any = (i + 1 + length * 3) * 100; - /** - * @tc.name fuzzTest - * @tc.number FMS_fuzzTest_updateform_2500 ~ FMS_fuzzTest_updateform_3200 - * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by Promise) - */ - it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { - const dataType = DATA_TYPE_LIST[i]; - const formId = `${tcNumber}`; - const formBindingData = getFuzzData(dataType); - console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); - console.log(`${promiseName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); - try { - const data = await formProvider.updateForm(formId, formBindingData); - console.log(`${promiseName} ${tcNumber} updateForm data: ${JSON.stringify(data)}`); - console.log(`${promiseName} ${tcNumber} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - } - }); - } - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/getParam.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/getParam.ets deleted file mode 100644 index 548b50013194036f9c6d2a1fa6556edb263fa98a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/getParam.ets +++ /dev/null @@ -1,171 +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. - */ - -export const REPEAT_COUNT = 2; - -export const DATA_TYPE_LIST = ['ARRAY', 'NUMBER', 'BOOLEAN', 'FUNCTION', 'STRING', 'OBJECT', 'NULL', 'UNDEFINED']; - -var RANDOM_BEGIN_POSITION = 0; -var RANDOM_BEGIN_POSITION_A = 2; -var STRING_RANDOM_LENGTH = 2064; -var BOOLEAN_RANDOM_LENGTH = 2; -var ARRAY_RANDOM_LENGTH = 10; -var ARRAY_RANDOM_TYPE_LENGTH = 3; -var OBJECT_RANDOM_LENGTH = 2; -var FUNCTION_RANDOM_LENGTH = 2; - -//string ascii -var STRING_RANDOM_LENGTH_A = 48; -var STRING_RANDOM_LENGTH_B = 58; -var STRING_RANDOM_LENGTH_C = 65; -var STRING_RANDOM_LENGTH_D = 91; -var STRING_RANDOM_LENGTH_E = 97; -var STRING_RANDOM_LENGTH_F = 122; - -// Return integer random, the range is: [iStart, iEnd) -function getIntegerRandom(iStart, iEnd) { - var decimal = iStart + (iEnd - iStart) * Math.random(); - return Math.floor(decimal); -} - -// return string random, the string length is: [0, 2064) -const stringTest = function () { - // string - var res = ''; - - // string length - var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, STRING_RANDOM_LENGTH); - for (var iAsciiToChar = RANDOM_BEGIN_POSITION; iAsciiToChar < iNumber; iAsciiToChar++) { - var iNumberString = getIntegerRandom(RANDOM_BEGIN_POSITION, RANDOM_BEGIN_POSITION_A); - - switch (iNumberString) { - case 0: - // get ascii [0-9] - iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_A, STRING_RANDOM_LENGTH_B); - break; - case 1: - // get ascii [A-Z] - iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_C, STRING_RANDOM_LENGTH_D); - break; - case 2: - default: - // get ascii [a-z] - iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_E, STRING_RANDOM_LENGTH_F); - break; - } - // from ascii to char - var asciiToChar = String.fromCharCode(iNumber); - res += asciiToChar; - } - console.log('The stringTest of this fuzzTest random:' + res); - return res; -}; - -// return number random, the number length is: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER] -const numberTest = function () { - const res = getIntegerRandom(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER + 1); - console.log('The numberTest of this fuzzTest random:' + res); - return res; -}; - -// return boolean random, the boolean value is: 0->(false), 1->(true) -const booleanTest = function () { - console.log('The booleanTest of this fuzzTest random'); - return Boolean(getIntegerRandom(RANDOM_BEGIN_POSITION, BOOLEAN_RANDOM_LENGTH)); -}; - -// null -const nullTest = function () { - console.log('The nullTest of this fuzzTest random'); - return null; -}; - -// undefined -const undefinedTest = function () { - console.log('The undefinedTest of this fuzzTest random'); - return undefined; -}; - -// return array random, the array value is: string,number,bool -const arrayTest = function () { - var arrValue = []; - - // array length - var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, ARRAY_RANDOM_LENGTH); - for (var iArrNumber = 0; iArrNumber < iNumber; iArrNumber++) { - // string,number,bool - iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, ARRAY_RANDOM_TYPE_LENGTH); - switch (iNumber) { - case 0: - arrValue[iArrNumber] = stringTest(); - break; - case 1: - arrValue[iArrNumber] = numberTest(); - break; - case 2: - arrValue[iArrNumber] = booleanTest(); - break; - default: - arrValue[iArrNumber] = ''; - } - } - console.log('The arrayTest of this fuzzTest random:' + arrValue); - return arrValue; -}; - -// return objectTest random, the objectTest value is: null, not null -const objectTest = function () { - var objectA = {}; - var objectb = { id: 'objectTest' }; - var objectB = Object.create(objectb); - - console.log('The objectTest of this fuzzTest random'); - return getIntegerRandom(RANDOM_BEGIN_POSITION, OBJECT_RANDOM_LENGTH) ? objectA : objectB; -}; - -// return functionTest random, the functionTest value is: null, not null -const functionTest = function () { - var functionA = {}; - var functionB = { id: 'functionTest' }; - - console.log('The functionTest of this fuzzTest random'); - return getIntegerRandom(RANDOM_BEGIN_POSITION, FUNCTION_RANDOM_LENGTH) ? functionA : functionB; -}; - -// return fuzz data -const getFuzzData = (datatype: string) => { - switch (datatype) { - case 'ARRAY': - return arrayTest(); - case 'BOOLEAN': - return booleanTest(); - case 'FUNCTION': - return functionTest(); - case 'NULL': - return nullTest(); - case 'NUMBER': - return numberTest(); - case 'OBJECT': - return objectTest(); - case 'STRING': - return stringTest(); - case 'UNDEFINED': - return undefinedTest(); - default: - return stringTest(); - } -}; - -export { getFuzzData, stringTest, numberTest, booleanTest, nullTest, undefinedTest, objectTest, arrayTest, functionTest }; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/BUILD.gn deleted file mode 100644 index 714c8278baabae1638cbebcf240efd012a68d4b5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormsOneAndOneTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormsOneAndOneTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/Test.json deleted file mode 100644 index 4065e8505654b35a06e32aea1b1107fac6508a16..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formsoneandonetest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormsOneAndOneTest.hap", - "FormSystemProviderB.hap", - "FormSystemProviderC.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json deleted file mode 100644 index 5c387f35e549c1a4e9a0c96d4bdc8e8efc0813b0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsoneandonetest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsoneandonetest", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 97f187805ddd3e803b7fc3550e49c8962fd136f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate'); - }, - onDestroy() { - console.info('Application onDestroy'); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 13ab6f9963b81bfec65f4113dddf673b95dd3fd3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,64 +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 featureAbility from '@ohos.ability.featureAbility'; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; -import testsuite from '../test/List.test.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormsOneAndOneTest`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`${this.componentName}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets deleted file mode 100644 index feeb66db6f2497be8a125f49ae49f5f30ef4cd73..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ /dev/null @@ -1,146 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getAllFormsInfoTest = (describeName, filterParameter) => { - const ERR_OK_CODE = 0; - const ERR_OK = `success`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0500 callback`; - const promiseName = `FMS_getFormsInfo_0500 promise`; - - const expectDataB = { - bundleName: 'com.ohos.st.formsystemproviderb', - moduleName: 'form_module_b', - abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', - name: 'FormB_Js001', - description: 'form_description_FormB_Js001', - descriptionId: 20, - type: 1, - jsComponentName: 'card_b', - colorMode: -1, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilityb', - updateDuration: 3, - scheduledUpdateTime: '10:30', - defaultDimension: 2, - supportDimensions: [1, 2], - metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, - }; - - const expectDataC = { - bundleName: 'com.ohos.st.formsystemproviderc', - moduleName: 'form_module_c', - abilityName: 'com.ohos.st.formsystemproviderc.MainAbility', - name: 'FormC_Js001', - description: 'form_description_FormC_Js001', - descriptionId: 30, - type: 1, - jsComponentName: 'card_c', - colorMode: 1, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilityc', - updateDuration: 4, - scheduledUpdateTime: '15:30', - defaultDimension: 3, - supportDimensions: [3, 4], - metaData: { customizeData: [{ name: 'originWidgetNameC', value: 'valueC' }] }, - }; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0500 - * @tc.desc: Query all form configuration information (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getAllFormsInfo((error, data) => { - console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - console.log(`${callbackName} forms amount: ${data.length}`); - - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${callbackName} formB amount: ${dataB.length}`); - const dataC = data.filter((form) => { - return `com.ohos.st.formsystemproviderc` === form.bundleName; - }); - console.log(`${callbackName} form dataC: ${JSON.stringify(dataC)}`); - console.log(`${callbackName} formC amount: ${dataC.length}`); - - expect(dataB.length).assertEqual(1); - expect(dataC.length).assertEqual(1); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0500 - * @tc.desc: Query all form configuration information (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getAllFormsInfo(); - console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} forms amount: ${data.length}`); - - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${promiseName} formB amount: ${dataB.length}`); - const dataC = data.filter((form) => { - return `com.ohos.st.formsystemproviderc` === form.bundleName; - }); - console.log(`${promiseName} form dataC: ${JSON.stringify(dataC)}`); - console.log(`${promiseName} formC amount: ${dataC.length}`); - - expect(dataB.length).assertEqual(1); - expect(dataC.length).assertEqual(1); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets deleted file mode 100644 index 62e9e40b90964827b6a7268f371bf58ec40f6b07..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets +++ /dev/null @@ -1,521 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getFormsInfoTest = (describeName, filterParameter) => { - const ERR_OK_CODE = 0; - const ERR_OK = `success`; - const ERR_GET_BUNDLE_FAILED_CODE = 5; - const ERR_GET_BUNDLE_FAILED = `failed to obtain the bundle information`; - const ERR_ADD_INVALID_PARAM_CODE = 7; - const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0900 callback`; - const promiseName = `FMS_getFormsInfo_0900 promise`; - const bundleName = ``; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0900 - * @tc.desc: Query specific form configuration information by empty bundle name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0900 - * @tc.desc: Query specific form configuration information by empty bundle name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1000 callback`; - const promiseName = `FMS_getFormsInfo_1000 promise`; - const bundleName = `wrong.bundle.name`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1000 - * @tc.desc: Query specific form configuration information by wrong bundle name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1000 - * @tc.desc: Query specific form configuration information by wrong bundle name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1100 callback`; - const promiseName = `FMS_getFormsInfo_1100 promise`; - const bundleName = `com.ohos.st.formsystemproviderb`; - - const expectDataB = { - bundleName: 'com.ohos.st.formsystemproviderb', - moduleName: 'form_module_b', - abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', - name: 'FormB_Js001', - description: 'form_description_FormB_Js001', - descriptionId: 20, - type: 1, - jsComponentName: 'card_b', - colorMode: -1, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilityb', - updateDuration: 3, - scheduledUpdateTime: '10:30', - defaultDimension: 2, - supportDimensions: [1, 2], - metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, - }; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1100 - * @tc.desc: Query specific form configuration information by correct bundle name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - console.log(`${callbackName} forms amount: ${data.length}`); - - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${callbackName} formB amount: ${dataB.length}`); - - expect(data.length).assertEqual(1); - expect(dataB.length).assertEqual(1); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1100 - * @tc.desc: Query specific form configuration information by correct bundle name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} forms amount: ${data.length}`); - - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${promiseName} formB amount: ${dataB.length}`); - - expect(data.length).assertEqual(1); - expect(dataB.length).assertEqual(1); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1400 callback`; - const promiseName = `FMS_getFormsInfo_1400 promise`; - const bundleName = ``; - const moduleName = `form_module_c`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1400 - * @tc.desc: Query specific form configuration information by empty bundle name and correct module name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1400 - * @tc.desc: Query specific form configuration information by empty bundle name and correct module name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1500 callback`; - const promiseName = `FMS_getFormsInfo_1500 promise`; - const bundleName = `wrong.bundle.name`; - const moduleName = `form_module_c`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1500 - * @tc.desc: Query specific form configuration information by wrong bundle name and correct module name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1500 - * @tc.desc: Query specific form configuration information by wrong bundle name and correct module name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); - expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1600 callback`; - const promiseName = `FMS_getFormsInfo_1600 promise`; - const bundleName = `com.ohos.st.formsystemproviderc`; - const moduleName = ``; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1600 - * @tc.desc: Query specific form configuration information by correct bundle name and empty module name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1600 - * @tc.desc: Query specific form configuration information by correct bundle name and empty module name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); - expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1700 callback`; - const promiseName = `FMS_getFormsInfo_1700 promise`; - const bundleName = `com.ohos.st.formsystemproviderc`; - const moduleName = `wrong.module.name`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1700 - * @tc.desc: Query specific form configuration information by correct bundle name and wrong module name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(JSON.stringify(data)).assertEqual(`[]`); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1700 - * @tc.desc: Query specific form configuration information by correct bundle name and wrong module name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - expect(JSON.stringify(data)).assertEqual(`[]`); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1800 callback`; - const promiseName = `FMS_getFormsInfo_1800 promise`; - const bundleName = `com.ohos.st.formsystemproviderc`; - const moduleName = `form_module_c`; - - const expectDataC = { - bundleName: 'com.ohos.st.formsystemproviderc', - moduleName: 'form_module_c', - abilityName: 'com.ohos.st.formsystemproviderc.MainAbility', - name: 'FormC_Js001', - description: 'form_description_FormC_Js001', - descriptionId: 30, - type: 1, - jsComponentName: 'card_c', - colorMode: 1, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilityc', - updateDuration: 4, - scheduledUpdateTime: '15:30', - defaultDimension: 3, - supportDimensions: [3, 4], - metaData: { customizeData: [{ name: 'originWidgetNameC', value: 'valueC' }] }, - }; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1800 - * @tc.desc: Query specific form configuration information by correct bundle name and correct module name (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - console.log(`${callbackName} forms amount: ${data.length}`); - - const dataC = data.filter((form) => { - return `com.ohos.st.formsystemproviderc` === form.bundleName; - }); - console.log(`${callbackName} form dataC: ${JSON.stringify(dataC)}`); - console.log(`${callbackName} formC amount: ${dataC.length}`); - - expect(data.length).assertEqual(1); - expect(dataC.length).assertEqual(1); - expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1800 - * @tc.desc: Query specific form configuration information by correct bundle name and correct module name (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} forms amount: ${data.length}`); - - const dataC = data.filter((form) => { - return `com.ohos.st.formsystemproviderc` === form.bundleName; - }); - console.log(`${promiseName} form dataC: ${JSON.stringify(dataC)}`); - console.log(`${promiseName} formC amount: ${dataC.length}`); - - expect(data.length).assertEqual(1); - expect(dataC.length).assertEqual(1); - expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 464a64cbc93aad8ee5a6f0d7ac2bed560e1368da..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,30 +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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; -import { getFormsInfoTest } from './GetFormsInfo.test.ets'; - -export default function testsuite() { - // FMS_getFormsInfo_0500 - getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); - // FMS_getFormsInfo_0900 - // FMS_getFormsInfo_1000 - // FMS_getFormsInfo_1100 - // FMS_getFormsInfo_1400 - // FMS_getFormsInfo_1500 - // FMS_getFormsInfo_1600 - // FMS_getFormsInfo_1700 fail - // FMS_getFormsInfo_1800 - getFormsInfoTest(`GetFormsInfoTest`, 0); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/BUILD.gn deleted file mode 100644 index facf49814209bca0f2a642848485fb138fcc15a9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormsOneAndTwoTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormsOneAndTwoTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/Test.json deleted file mode 100644 index f4871e5a3bb134f43caa774d212c3473a99bbbcc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formsoneandtwotest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormsOneAndTwoTest.hap", - "FormSystemProviderA.hap", - "FormSystemProviderB.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json deleted file mode 100644 index 61e499a4209e71896f5049799433df0e04531f88..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsoneandtwotest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsoneandtwotest", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 97f187805ddd3e803b7fc3550e49c8962fd136f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate'); - }, - onDestroy() { - console.info('Application onDestroy'); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 8d55e13b3899bd4b51a499a9670157fe84fe41e9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,64 +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 featureAbility from '@ohos.ability.featureAbility'; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; -import testsuite from '../test/List.test.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormsOneAndTwoTest`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`${this.componentName}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets deleted file mode 100644 index 8013bc9476503cd8ea823de77a9528858c543c2b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ /dev/null @@ -1,169 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getAllFormsInfoTest = (describeName, filterParameter) => { - const ERR_OK_CODE = 0; - const ERR_OK = `success`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0600 callback`; - const promiseName = `FMS_getFormsInfo_0600 promise`; - - const expectDataA01 = { - bundleName: 'com.ohos.st.formsystemprovidera', - moduleName: 'form_module_a', - abilityName: 'com.ohos.st.formsystemprovidera.MainAbility', - name: 'FormA_Js001', - description: 'form_description_FormA_Js001', - descriptionId: 0, - type: 1, - jsComponentName: 'card_a01', - colorMode: 0, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilitya01', - updateDuration: 1, - scheduledUpdateTime: '5:30', - defaultDimension: 1, - supportDimensions: [1, 3], - metaData: { customizeData: [{ name: 'originWidgetNameA01', value: 'valueA01' }] }, - }; - - const expectDataA02 = { - bundleName: 'com.ohos.st.formsystemprovidera', - moduleName: 'form_module_a', - abilityName: 'com.ohos.st.formsystemprovidera.MainAbility', - name: 'FormA_Js002', - description: 'form_description_FormA_Js002', - descriptionId: 10, - type: 1, - jsComponentName: 'card_a02', - colorMode: 1, - isDefault: 0, - updateEnabled: 0, - formVisibleNotify: 0, - formConfigAbility: 'abilitya02', - updateDuration: 2, - scheduledUpdateTime: '20:30', - defaultDimension: 4, - supportDimensions: [1, 2, 3, 4], - metaData: { customizeData: [{ name: 'originWidgetNameA02', value: 'valueA02' }] }, - }; - - const expectDataB = { - bundleName: 'com.ohos.st.formsystemproviderb', - moduleName: 'form_module_b', - abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', - name: 'FormB_Js001', - description: 'form_description_FormB_Js001', - descriptionId: 20, - type: 1, - jsComponentName: 'card_b', - colorMode: -1, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilityb', - updateDuration: 3, - scheduledUpdateTime: '10:30', - defaultDimension: 2, - supportDimensions: [1, 2], - metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, - }; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0600 - * @tc.desc: Query all form configuration information (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getAllFormsInfo((error, data) => { - console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - console.log(`${callbackName} forms amount: ${data.length}`); - - const dataA = data.filter((form) => { - return `com.ohos.st.formsystemprovidera` === form.bundleName; - }); - console.log(`${callbackName} form dataA: ${JSON.stringify(dataA)}`); - console.log(`${callbackName} formA amount: ${dataA.length}`); - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${callbackName} formB amount: ${dataB.length}`); - - expect(dataA.length).assertEqual(2); - expect(dataB.length).assertEqual(1); - expect(JSON.stringify(dataA[0])).assertEqual(JSON.stringify(expectDataA01)); - expect(JSON.stringify(dataA[1])).assertEqual(JSON.stringify(expectDataA02)); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0600 - * @tc.desc: Query all form configuration information (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getAllFormsInfo(); - console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} forms amount: ${data.length}`); - - const dataA = data.filter((form) => { - return `com.ohos.st.formsystemprovidera` === form.bundleName; - }); - console.log(`${promiseName} form dataA: ${JSON.stringify(dataA)}`); - console.log(`${promiseName} formA amount: ${dataA.length}`); - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${promiseName} formB amount: ${dataB.length}`); - - expect(dataA.length).assertEqual(2); - expect(dataB.length).assertEqual(1); - expect(JSON.stringify(dataA[0])).assertEqual(JSON.stringify(expectDataA01)); - expect(JSON.stringify(dataA[1])).assertEqual(JSON.stringify(expectDataA02)); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 6c6ada8b821917db9f724bb0b5d21045f8613417..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,20 +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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; - -export default function testsuite() { - // FMS_getFormsInfo_0600 - getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/BUILD.gn deleted file mode 100644 index 70d1d9ffcdc23ce0024858adb73f2bcbb387479f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormsOneAndZeroTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormsOneAndZeroTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/Test.json deleted file mode 100644 index cc2d5a42b43ae718cc45ff45d4b2e4da3b7b3bda..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formsoneandzerotest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormsOneAndZeroTest.hap", - "FormSystemProviderB.hap", - "FormSystemProviderD.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json deleted file mode 100644 index 6d8f937f765b189e1938954db4037eb9e0b39456..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formsoneandzerotest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formsoneandzerotest", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 97f187805ddd3e803b7fc3550e49c8962fd136f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate'); - }, - onDestroy() { - console.info('Application onDestroy'); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 854ba1dd15adbe03b71de3e7830c5a0d5b9cfa0b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,64 +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 featureAbility from '@ohos.ability.featureAbility'; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; -import testsuite from '../test/List.test.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormsOneAndZeroTest`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`${this.componentName}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets deleted file mode 100644 index a78494cc3a60910ae056361afadaefb08672d3ad..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ /dev/null @@ -1,125 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getAllFormsInfoTest = (describeName, filterParameter) => { - const ERR_OK_CODE = 0; - const ERR_OK = `success`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0400 callback`; - const promiseName = `FMS_getFormsInfo_0400 promise`; - - const expectDataB = { - bundleName: 'com.ohos.st.formsystemproviderb', - moduleName: 'form_module_b', - abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', - name: 'FormB_Js001', - description: 'form_description_FormB_Js001', - descriptionId: 20, - type: 1, - jsComponentName: 'card_b', - colorMode: -1, - isDefault: 1, - updateEnabled: 1, - formVisibleNotify: 1, - formConfigAbility: 'abilityb', - updateDuration: 3, - scheduledUpdateTime: '10:30', - defaultDimension: 2, - supportDimensions: [1, 2], - metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, - }; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0400 - * @tc.desc: Query all form configuration information (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getAllFormsInfo((error, data) => { - console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - console.log(`${callbackName} forms amount: ${data.length}`); - - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${callbackName} formB amount: ${dataB.length}`); - const dataD = data.filter((form) => { - return `com.ohos.st.formsystemproviderd` === form.bundleName; - }); - console.log(`${callbackName} form dataD: ${JSON.stringify(dataD)}`); - console.log(`${callbackName} formD amount: ${dataD.length}`); - - expect(dataB.length).assertEqual(1); - expect(dataD.length).assertEqual(0); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - expect(JSON.stringify(dataD)).assertEqual(`[]`); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0400 - * @tc.desc: Query all form configuration information (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getAllFormsInfo(); - console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} forms amount: ${data.length}`); - - const dataB = data.filter((form) => { - return `com.ohos.st.formsystemproviderb` === form.bundleName; - }); - console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); - console.log(`${promiseName} formB amount: ${dataB.length}`); - const dataD = data.filter((form) => { - return `com.ohos.st.formsystemproviderd` === form.bundleName; - }); - console.log(`${promiseName} form dataD: ${JSON.stringify(dataD)}`); - console.log(`${promiseName} formD amount: ${dataD.length}`); - - expect(dataB.length).assertEqual(1); - expect(dataD.length).assertEqual(0); - expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); - expect(JSON.stringify(dataD)).assertEqual(`[]`); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 8ec9f9ce41da64feec7168a9bc457c4473c020f6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,20 +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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; - -export default function testsuite() { - // FMS_getFormsInfo_0400 - getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/BUILD.gn deleted file mode 100644 index 64e49c2661c17084a7e43b07ca00c6db2a9017b3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormsWithoutPermTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormsWithoutPermTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/Test.json deleted file mode 100644 index f688487096c82f58525b3d0569a1e338b9cf278c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formswithoutpermtest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormsWithoutPermTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json deleted file mode 100644 index 298cc379014f29c7034516a55d3740099a385183..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formswithoutpermtest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formswithoutpermtest", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 97f187805ddd3e803b7fc3550e49c8962fd136f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate'); - }, - onDestroy() { - console.info('Application onDestroy'); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 4f5f3f4f6714e22d494dac28c95bba1c75b2decb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,64 +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 featureAbility from '@ohos.ability.featureAbility'; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; -import testsuite from '../test/List.test.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormsWithoutPermTest`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`${this.componentName}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets deleted file mode 100644 index 912099b87c13246a2912210dfe5bc32174b37d5a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ /dev/null @@ -1,72 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getAllFormsInfoTest = (describeName, filterParameter) => { - const ERR_OK_CODE = 0; - const ERR_OK = `success`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0200 callback`; - const promiseName = `FMS_getFormsInfo_0200 promise`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0200 - * @tc.desc: Query all form configuration information without permission (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getAllFormsInfo((error, data) => { - console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(JSON.stringify(data)).assertEqual(`[]`); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0200 - * @tc.desc: Query all form configuration information without permission (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getAllFormsInfo(); - console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); - expect(JSON.stringify(data)).assertEqual(`[]`); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets deleted file mode 100644 index e2395efbe6cb73d74020b4418b061bdd6e60c10d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets +++ /dev/null @@ -1,125 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getFormsInfoTest = (describeName, filterParameter) => { - const ERR_PERMISSION_DENY_CODE = 2; - const ERR_PERMISSION_DENY = `does not have permission to use forms`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0800 callback`; - const promiseName = `FMS_getFormsInfo_0800 promise`; - const bundleName = `1`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0800 - * @tc.desc: Query specific form configuration information by bundle name without permission (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); - expect(error.message).assertEqual(ERR_PERMISSION_DENY); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0800 - * @tc.desc: Query specific form configuration information by bundle name without permission (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); - expect(error.message).assertEqual(ERR_PERMISSION_DENY); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_1300 callback`; - const promiseName = `FMS_getFormsInfo_1300 promise`; - const bundleName = `2`; - const moduleName = `a`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_1300 - * @tc.desc: Query specific form configuration information by bundle name and module name without permission (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getFormsInfo(bundleName, moduleName, (error, data) => { - console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); - expect(error.message).assertEqual(ERR_PERMISSION_DENY); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_1300 - * @tc.desc: Query specific form configuration information by bundle name and module name without permission (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getFormsInfo(bundleName, moduleName); - console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); - expect(error.message).assertEqual(ERR_PERMISSION_DENY); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 4c43d6022a6a5a24e18ca7df7d570833f6c48c5e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,24 +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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; -import { getFormsInfoTest } from './GetFormsInfo.test.ets'; - -export default function testsuite() { - // FMS_getFormsInfo_0200 - getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); - // FMS_getFormsInfo_0800 - // FMS_getFormsInfo_1300 - getFormsInfoTest(`GetFormsInfoTest`, 0); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/BUILD.gn deleted file mode 100644 index 0f8fc3e65bd6662217610c54395ac6586bee766c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormsZeroTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormsZeroTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/Test.json deleted file mode 100644 index cfa74ea30d0e844b3fedf073375e9613b758c919..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formszerotest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormsZeroTest.hap", - "FormSystemProviderD.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json deleted file mode 100644 index f34dca2bbd67151e3c0fd5d25cd3bc2fc5c35f4a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formszerotest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formszerotest", - "name": ".FormSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 97f187805ddd3e803b7fc3550e49c8962fd136f1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate'); - }, - onDestroy() { - console.info('Application onDestroy'); - }, -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 81b471be64e60cf19f4ac105917762e00b7a6825..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,64 +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 featureAbility from '@ohos.ability.featureAbility'; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index.ets'; -import testsuite from '../test/List.test.ets'; - -@Entry -@Component -struct Index { - private componentName: string = `FormsZeroTest`; - - aboutToAppear() { - console.info(`${this.componentName} start run testcase!!!!`); - - featureAbility.getWant() - .then((want: any) => { - console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text(`${this.componentName}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets deleted file mode 100644 index 82b7c3f4192444ea275691a4fbeff18d311307ab..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ /dev/null @@ -1,84 +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 formHost from '@ohos.application.formHost'; -import { describe, expect, it } from 'deccjsunit/index.ets'; - -export const getAllFormsInfoTest = (describeName, filterParameter) => { - const ERR_OK_CODE = 0; - const ERR_OK = `success`; - - describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0300 callback`; - const promiseName = `FMS_getFormsInfo_0300 promise`; - - /** - * @tc.name: getFormsInfo - * @tc.number: FMS_getFormsInfo_0300 - * @tc.desc: Query all form configuration information without permission (by AsyncCallback) - */ - it(`${callbackName}`, filterParameter, async (done) => { - console.log(`==========${callbackName} ${describeName} start==========`); - - try { - formHost.getAllFormsInfo((error, data) => { - console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); - - const dataD = data.filter((form) => { - return `com.ohos.st.formsystemproviderd` === form.bundleName; - }); - console.log(`${callbackName} form dataD: ${JSON.stringify(dataD)}`); - console.log(`${callbackName} formD amount: ${dataD.length}`); - expect(dataD.length).assertEqual(0); - expect(JSON.stringify(dataD)).assertEqual(`[]`); - expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); - done(); - console.log(`==========${callbackName} ${describeName} end==========`); - }); - } catch (error) { - console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); - console.log(`${callbackName} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.name getFormsInfo - * @tc.number FMS_getFormsInfo_0300 - * @tc.desc: Query all form configuration information without permission (by Promise) - */ - it(`${promiseName}`, filterParameter, async (done) => { - console.log(`==========${promiseName} ${describeName} start==========`); - - try { - const data = await formHost.getAllFormsInfo(); - const dataD = data.filter((form) => { - return `com.ohos.st.formsystemproviderd` === form.bundleName; - }); - console.log(`${callbackName} form dataD: ${JSON.stringify(dataD)}`); - console.log(`${callbackName} formD amount: ${dataD.length}`); - expect(dataD.length).assertEqual(0); - expect(JSON.stringify(dataD)).assertEqual(`[]`); - done(); - console.log(`==========${promiseName} ${describeName} end==========`); - } catch (error) { - console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); - console.log(`${promiseName} should not reach here`); - expect().assertFail(); - } - }); - }); -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 13a30fbf24c23ce656982bc17a1468bb6657db0c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,20 +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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; - -export default function testsuite() { - // FMS_getFormsInfo_0300 - getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/BUILD.gn deleted file mode 100644 index 4a1acd755daaccc88b1f77f5f5e9df3057083899..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormHostDeathRecipientTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormHostDeathRecipientTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/Test.json deleted file mode 100644 index f483783de3d75649811079285bf017af262ea637..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/Test.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "120000", - "package": "com.ohos.st.formhostdeathrecipienttest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormHostDeathRecipientTest.hap", - "FormSystemHostK.hap", - "FormSystemHostL.hap", - "FormSupplyAppF.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 3eb379cc5db1679076f79d4370c16edbe8680ae0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 60000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Host Death Recipient Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets deleted file mode 100644 index 9582935d0ff6591fa6fb38e5e92c8b1a61fd0bdc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets +++ /dev/null @@ -1,428 +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 featureAbility from '@ohos.ability.featureAbility'; -import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index.ets'; - -const onAcquiredEvent = { - events: [`FMS_FormOnAcquired_commonEvent`], -}; -const onSupplyEvent = { - events: [`FMS_FormSupply_commonEvent`], -}; -const onRequestEvent = { - events: [`FMS_FormOnRequest_commonEvent`], -}; -const formOnTerminateEvent = `FMS_FormTerminate_commonEvent`; - -let tcNumber; -let hostCounter; -let providerCounter; -let onAcquiredEventSubscriber; -let onSupplyEventSubscriber; -let onRequestEventSubscriber; - -export default function test() { - describe(`FmsHostDeathRecipientTest`, () => { - - beforeEach(async () => { - tcNumber = `FmsHostDeathRecipientTest`; - hostCounter = 0; - providerCounter = 0; - onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent); - onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); - onRequestEventSubscriber = await commonEvent.createSubscriber(onRequestEvent); - }); - - /** - * @tc.number: FMS_hostDeathRecipient_0100 - * @tc.name: Reset host ability. - * @tc.desc: The provider's onDestroy event will be triggered. - */ - it(`FMS_hostDeathRecipient_0100`, 0, async (done) => { - tcNumber = `FMS_hostDeathRecipient_0100`; - let tempFormId; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const hostFormId = data.data; - console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); - - if (data.parameters?.cast) { - tempFormId = hostFormId; - } - if (++hostCounter == 2) { - // onAcquired * 2 - commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); - // terminate host - commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); - console.info(`${tcNumber} onAcquiredCallBack end`); - } - }); - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const supplyFormId = getSupplyFormId(data); - console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); - - if (`onDestroy` == kind) { - expect(tempFormId).assertEqual(supplyFormId); - commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); - - await sleep(1000); - done(); - } - }); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - isCreate: true, - createTempAndNormal: true, - subscribeTerminate: true - }); - }); - - /** - * @tc.number: FMS_hostDeathRecipient_0200 - * @tc.name: Reset host ability and requestForm. - * @tc.desc: The provider's onDestroy event will be triggered. - */ - it(`FMS_hostDeathRecipient_0200`, 0, async (done) => { - tcNumber = `FMS_hostDeathRecipient_0200`; - let normalFormId; - let tempFormId; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const hostFormId = data.data; - console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); - - if (data.parameters?.cast) { - tempFormId = hostFormId; - } else { - normalFormId = hostFormId; - } - if (++hostCounter == 2) { - // onAcquired * 2 - commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); - // terminate host - commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); - await sleep(2000); - // reset host - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - formId: normalFormId, - isCreate: true, - requestForm: true, - requestId: normalFormId, - subscribeTerminate: true - }); - console.info(`${tcNumber} onAcquiredCallBack end`); - } - }); - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const supplyFormId = getSupplyFormId(data); - console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); - - if (`onDestroy` == kind) { - expect(tempFormId).assertEqual(supplyFormId); - } else if (`onUpdate` == kind) { - expect(normalFormId).assertEqual(supplyFormId); - } - if (++providerCounter == 4) { - // onCreate * 2 onDestroy * 1 onUpdate * 1 - commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); - console.info(`${tcNumber} onSupplyCallBack end`); - await sleep(1000); - done(); - } - }); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - isCreate: true, - createTempAndNormal: true, - subscribeTerminate: true - }); - }); - - /** - * @tc.number: FMS_hostDeathRecipient_0300 - * @tc.name: Reset host ability. - * @tc.desc: The provider's onDestroy event will be triggered but requestForm will be failed. - */ - it(`FMS_hostDeathRecipient_0300`, 0, async (done) => { - tcNumber = `FMS_hostDeathRecipient_0300`; - let tempFormId; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const hostFormId = data.data; - console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); - - if (data.parameters) { - tempFormId = hostFormId; - commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); - // terminate host - commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); - console.info(`${tcNumber} onAcquiredCallBack end`); - } - }); - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const supplyFormId = getSupplyFormId(data); - console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); - - if (`onDestroy` == kind) { - expect(tempFormId).assertEqual(supplyFormId); - } - if (++providerCounter == 2) { - // onCreate * 1 - // onDestroy * 1 - commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); - - await sleep(1000); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - requestForm: true, - requestId: tempFormId - }); - console.info(`${tcNumber} onSupplyCallBack end`); - } - }); - commonEvent.subscribe(onRequestEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onRequestCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - commonEvent.unsubscribe(onRequestEventSubscriber, unsubscribeOnRequestCallback); - - const error = data.parameters.error; - expect(error.code).assertEqual(9); - expect(error.message).assertEqual(`the ID of the form to be operated does not exist`); - console.info(`${tcNumber} onRequestCallBack end`); - - await sleep(1000); - done(); - }); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - isCreate: true, - temporary: true, - subscribeTerminate: true - }); - }); - - /** - * @tc.number: FMS_hostDeathRecipient_0500 - * @tc.name: Reset host ability and requestForm. - * @tc.desc: The provider's onUpdate event will be triggered. - */ - it(`FMS_hostDeathRecipient_0500`, 0, async (done) => { - tcNumber = `FMS_hostDeathRecipient_0500`; - let hostFormId; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - hostFormId = data.data; - console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); - - commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); - // start abilityb - await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, { - formId: hostFormId, - isCreate: true - }); - // terminate host - commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); - await sleep(2000); - // reset host a - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - formId: hostFormId, - requestForm: true, - requestId: hostFormId, - }); - console.info(`${tcNumber} onAcquiredCallBack end`); - }); - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const supplyFormId = getSupplyFormId(data); - console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); - - if (`onUpdate` == kind) { - expect(hostFormId).assertEqual(supplyFormId); - } - if (++providerCounter == 2) { - // onCreate * 1 host A - // onUpdate * 1 - commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); - console.info(`${tcNumber} onSupplyCallBack end`); - - await sleep(1000); - done(); - } - }); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - isCreate: true, - subscribeTerminate: true - }); - }); - - /** - * @tc.number: FMS_hostDeathRecipient_0600 - * @tc.name: Reset host ability and requestForm. - * @tc.desc: The provider's onUpdate event will be triggered. - */ - it(`FMS_hostDeathRecipient_0600`, 0, async (done) => { - tcNumber = `FMS_hostDeathRecipient_0600`; - let hostFormId; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - hostFormId = data.data; - console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); - - commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); - // start abilityb - await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, { - formId: hostFormId, - isCreate: true - }); - // terminate host - commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); - await sleep(2000); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - formId: hostFormId, - isCreate: true, - requestForm: true, - requestId: hostFormId, - subscribeTerminate: true - }); - await sleep(2000); - await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, { - formId: hostFormId, - requestForm: true, - requestId: hostFormId, - }); - console.info(`${tcNumber} onAcquiredCallBack end`); - }); - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const supplyFormId = getSupplyFormId(data); - console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); - - if (`onUpdate` == kind) { - expect(hostFormId).assertEqual(supplyFormId); - } - if (++providerCounter == 3) { - // onCreate * 1 host A - // onUpdate * 2 - commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); - console.info(`${tcNumber} onSupplyCallBack end`); - - await sleep(1000); - done(); - } - }); - await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { - isCreate: true, - subscribeTerminate: true - }); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const getSupplyFormId = (data) => { - switch (data.parameters.kind) { - case `onCreate`: - return JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`]; - case `onVisibilityChange`: - return Object.keys(JSON.parse(data.parameters.parameters))[0] - default: - return data.parameters.parameters; - } -} - -const unsubscribeOnAcquiredCallback = () => { - console.info(`${tcNumber} unsubscribeOnAcquired callback`); -} -const unsubscribeOnSupplyCallback = () => { - console.info(`${tcNumber} unsubscribeOnSupply callback`); -} -const unsubscribeOnRequestCallback = () => { - console.info(`${tcNumber} unsubscribeOnRequest callback`); -} -const publishOnTerminateCallback = () => { - console.info(`${tcNumber} publishOnTerminate callback`); -} - -interface Parameters { - formId?: String, - name?: String, - bundle?: String, - ability?: String, - moduleName?: String, - temporary?: Boolean, - isCreate?: Boolean, - createTempAndNormal?: Boolean, - subscribeTerminate?: Boolean, - tempParam?: Object, - [key: string]: any -} - -const startAbility = async ( - bundleName, - abilityName, - parameters: Parameters) => { - - parameters = Object.assign({ - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - temporary: false, - isCreate: false, - createTempAndNormal: false, - subscribeTerminate: false, - }, parameters); - if (parameters.createTempAndNormal) { - parameters.tempParam = { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry` - }; - } - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: bundleName, - abilityName: abilityName, - parameters: parameters - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} featureAbility.startAbility error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } -}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 29aa65899a23028412c6e4025e8244cdf28b6755..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsHostDeathRecipient.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/BUILD.gn deleted file mode 100644 index 76f16b79fcd14b56d050b9685fc3e0a2396d7341..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormPerformanceTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormPerformanceTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json deleted file mode 100644 index a98cb8fb6eea7422eb6ac0deef2522567d112e7a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formperformancetest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormPerformanceTest.hap", - "FormSystemHostK.hap", - "FormSupplyAppG.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index f9be09439923684fdbfa2dd6766c9ce14c2f54f8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index a9c2b4cdd90c7d21bf7d3e2427138a7e4df01192..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 20000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Performance Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets deleted file mode 100644 index 4d8c1fb20abb02a3cab4af9f362a967dc8db0de5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets +++ /dev/null @@ -1,940 +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 featureAbility from '@ohos.ability.featureAbility'; -import formHost from '@ohos.application.formHost'; -import commonEvent from '@ohos.commonEvent'; -import { getCurrentTime } from '@ohos.systemTime'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index.ets'; - -const onAcquiredEvent = { - events: [`FMS_FormOnAcquired_commonEvent`], -}; -const onSupplyEvent = { - events: [`FMS_FormSupply_commonEvent`], -}; -const formOnDeleteEvent = `FMS_FormDelete_commonEvent`; - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`${tcNumber} unsubscribeOnAcquired callback`); -} -const unsubscribeOnSupplyCallback = (tcNumber) => { - console.info(`${tcNumber} unsubscribeOnSupply callback`); -} -const publishOnDeleteCallback = (tcNumber, done) => { - console.info(`${tcNumber} publishOnDelete callback`); - done(); -} - -let onAcquiredEventSubscriber; -let onSupplyEventSubscriber; - -export default function test() { - describe(`FmsPerformanceTest`, () => { - - beforeEach(async () => { - onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent); - onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); - }); - - /** - * @tc.number: FMS_performanceTest_0100 - * @tc.name: Performance test. - * @tc.desc: Create form. - */ - it(`FMS_performanceTest_0100`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0100`; - const timeout = 1000; - let endflag = 0; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - const hostEndTime = data.parameters.time; - const hostTime = hostEndTime - startTime - console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onCreate` == kind) { - const providerEndTime = data.parameters.time; - const providerTime = providerEndTime - startTime; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onCreate end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - } - }); - - const startTime = await getCurrentTime(); - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0200 - * @tc.name: Performance test. - * @tc.desc: Delete form. - */ - it(`FMS_performanceTest_0200`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0200`; - const timeout = 1000; - let startTime = -1; - let endflag = 0; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`deleteForm` == data.parameters.kind) { - startTime = data.parameters.startTime; - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback_deleteForm end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - } - }); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onDestroy` == kind) { - setTimeout(() => { - const providerEndTime = data.parameters.time; - const providerTime = providerEndTime - startTime; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onDestroy end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }, 2000); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - deleteForm: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0300 - * @tc.name: Performance test. - * @tc.desc: Release form. - */ - it(`FMS_performanceTest_0300`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0300`; - const timeout = 1000; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`release` == data.parameters.kind) { - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${hostTime}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback_release end`); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - releaseForm: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0400 - * @tc.name: Performance test. - * @tc.desc: Cast temp form. - */ - it(`FMS_performanceTest_0400`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0400`; - const timeout = 500; - let startTime = -1; - let endflag = 0; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`castTempForm` == data.parameters.kind) { - startTime = data.parameters.startTime; - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); - console.info(`${tcNumber} onAcquiredCallback_castTempForm end`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - } - }); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onCastToNormal` == kind) { - setTimeout(() => { - const providerEndTime = data.parameters.time; - const providerTime = providerEndTime - startTime; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onCastToNormal end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }, 2000); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - castTempForm: true, - temporary: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0500 - * @tc.name: Performance test. - * @tc.desc: Notify visible forms. - */ - it(`FMS_performanceTest_0500`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0500`; - const timeout = 500; - let startTime = -1; - let endflag = 0; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`notifyVisibleForms` == data.parameters.kind) { - startTime = data.parameters.startTime; - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback_notifyVisibleForms end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - } - }); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onVisibilityChange` == kind) { - setTimeout(() => { - const providerEndTime = data.parameters.time; - const providerTime = providerEndTime - startTime; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onVisibilityChange end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }, 2000); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - notifyVisibleForms: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0600 - * @tc.name: Performance test. - * @tc.desc: Notify invisible forms. - */ - it(`FMS_performanceTest_0600`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0600`; - const timeout = 500; - let startTime = -1; - let endflag = 0; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`notifyInvisibleForms` == data.parameters.kind) { - startTime = data.parameters.startTime; - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback_notifyInvisibleForms end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - } - }); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onVisibilityChange` == kind) { - setTimeout(() => { - const providerEndTime = data.parameters.time; - const providerTime = providerEndTime - startTime; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onVisibilityChange end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }, 2000); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - notifyInvisibleForms: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0700 - * @tc.name: Performance test. - * @tc.desc: Request forms. - */ - it(`FMS_performanceTest_0700`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0700`; - const timeout = 100; - let startTime = -1; - let endflag = 0; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`request` == data.parameters.kind) { - startTime = data.parameters.startTime; - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - } - }); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onUpdate` == kind) { - setTimeout(() => { - const providerEndTime = data.parameters.time; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerEndTime - startTime)}`); - expect(providerEndTime - startTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onUpdate end`); - - if (++endflag == 2) { - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }, 2000); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - requestForm: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0800 - * @tc.name: Performance test. - * @tc.desc: Update form. - */ - it(`FMS_performanceTest_0800`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0800`; - const timeout = 100; - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onUpdateForm` == kind) { - const providerTime = data.parameters.time; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onUpdateForm end`); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - notifyVisibleForms: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_0900 - * @tc.name: Performance test. - * @tc.desc: Set next refresh time. - */ - it(`FMS_performanceTest_0900`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_0900`; - const timeout = 100; - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onSetFormNextRefreshTime` == kind) { - const providerTime = data.parameters.time; - console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); - expect(providerTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - console.info(`${tcNumber} onSupplyCallback_onSetFormNextRefreshTime end`); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [supplyFormId] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }); - - setTimeout(async () => { - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - notifyVisibleForms: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }, 2000); - }); - - /** - * @tc.number: FMS_performanceTest_1000 - * @tc.name: Performance test. - * @tc.desc: Enable update forms. - */ - it(`FMS_performanceTest_1000`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_1000`; - const timeout = 100; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`enableUpdate` == data.parameters.kind) { - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${hostTime}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback_enableUpdate end`); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - enableUpdate: true, - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_1100 - * @tc.name: Performance test. - * @tc.desc: Disable update forms. - */ - it(`FMS_performanceTest_1100`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_1100`; - const timeout = 100; - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); - - if (`disableUpdate` == data.parameters.kind) { - const hostTime = data.parameters.hostTime; - console.info(`${tcNumber} hostTime: ${hostTime}`); - expect(hostTime < timeout).assertEqual(true); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback_disableUpdate end`); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [data.data] - } - }, () => publishOnDeleteCallback(tcNumber, done)); - }, 500); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true, - disableUpdate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_performanceTest_1300 - * @tc.name: Performance test. - * @tc.desc: Get forms info. - */ - it(`FMS_performanceTest_1300`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_1300`; - const timeout = 10; - - const startTime = await getCurrentTime(); - const data = await formHost.getAllFormsInfo(); - console.info(`${tcNumber} getAllFormsInfo result: ${JSON.stringify(data)}`); - const endTime = await getCurrentTime(); - - console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); - expect(endTime - startTime < timeout); - done(); - }); - - /** - * @tc.number: FMS_performanceTest_1400 - * @tc.name: Performance test. - * @tc.desc: Get forms info by bundle. - */ - it(`FMS_performanceTest_1400`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_1400`; - const timeout = 10; - - const startTime = await getCurrentTime(); - const data = await formHost.getFormsInfo(`com.form.formsystemtestserviceg.hmservice`); - console.info(`${tcNumber} getFormsInfoByBundle result: ${JSON.stringify(data)}`); - const endTime = await getCurrentTime(); - - console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); - expect(endTime - startTime < timeout); - done(); - }); - - /** - * @tc.number: FMS_performanceTest_1500 - * @tc.name: Performance test. - * @tc.desc: Get forms info by module. - */ - it(`FMS_performanceTest_1500`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_1500`; - const timeout = 10; - - const startTime = await getCurrentTime(); - const data = await formHost.getFormsInfo(`com.form.formsystemtestserviceg.hmservice`, `entry`); - console.info(`${tcNumber} getFormsInfoByModule result: ${JSON.stringify(data)}`); - const endTime = await getCurrentTime(); - - console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); - expect(endTime - startTime < timeout); - done(); - }); - - /** - * @tc.number: FMS_performanceTest_1600 - * @tc.name: Performance test. - * @tc.desc: Form System Ready. - */ - it(`FMS_performanceTest_1600`, 0, async (done) => { - const tcNumber = `FMS_performanceTest_1600`; - const timeout = 10; - - const startTime = await getCurrentTime(); - const data = await formHost.isSystemReady(); - console.info(`${tcNumber} isSystemReady result: ${JSON.stringify(data)}`); - const endTime = await getCurrentTime(); - - console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); - expect(endTime - startTime < timeout); - done(); - }); - }); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index af887f8d2a00700b6ba68acc5cd75c74fd774fc1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsPerformanceTest.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/BUILD.gn deleted file mode 100644 index 33df7585de182997cbc9c36cf2e6f46b72f42bb3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormReleaseTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormReleaseTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/Test.json deleted file mode 100644 index 8c44daddb02f31c7bf7fcbf042e781616de42a7b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/Test.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formreleasetest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormReleaseTest.hap", - "FormSystemHostC.hap", - "FormSystemHostD.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ba35d8cefea74093b9fe561b2623dfbcbc745a17..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 20000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets deleted file mode 100644 index b55e3a820a56bde86cb5059ce9aa3c02dc6bf41f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets +++ /dev/null @@ -1,574 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; -var onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; -var onReleasedFormEvent = { - events: ["FMS_FormOnReleased_commonEvent"], -}; -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnAcquired; -var subscriberOnDeleted; -var subscriberOnReleased; - -export default function test() { - describe(`FmsReleaseFormTest`, () => { - - beforeAll(async (done) => { - done(); - }) - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); - }) - - /** - * @tc.number: FMS_releaseForm_0200 - * @tc.name: host does not have permission - * @tc.desc: 1.release the form that formID is 1 - * 2.Verify the result is false - */ - it(`FMS_releaseForm_0200`, 0, async (done) => { - console.log(`FMS_releaseForm_0200 start`); - let formId; - - function onReleasedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0200 onReleasedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0200")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_releaseForm_0200", done)); - } - - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0200 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_0200")) - formId = data.data; - commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); - - console.log(`FMS_releaseForm_0200 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "releaseForm" : true, - "releaseId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0200 featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - - console.log(`FMS_releaseForm_0200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0200 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_releaseForm_0300 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.release the form - * 2.Verify the result is false - */ - it(`FMS_releaseForm_0300`, 0, async (done) => { - console.log(`FMS_releaseForm_0300 start`); - - function onReleasedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0300 onReleasedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0300")); - setTimeout(function () { - console.info('FMS_releaseForm_0300 onReleasedCallBack end'); - console.log(`FMS_releaseForm_0300 end`); - done(); - }, 100); - } - commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); - - console.log(`FMS_releaseForm_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "releaseForm" : true, - "releaseId" : "-1", - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_releaseForm_0400 - * @tc.name: formID id is error(formID = 0) - * @tc.desc: 1.release the form - * 2.Verify the result is false - */ - it(`FMS_releaseForm_0400`, 0, async (done) => { - console.log(`FMS_releaseForm_0400 start`); - - function onReleaseCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0400 onReleaseCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0400")); - setTimeout(function () { - console.info('FMS_releaseForm_0400 onReleaseCallBack end'); - console.log(`FMS_releaseForm_0400 end`); - done(); - }, 100); - } - commonEvent.subscribe(subscriberOnReleased, onReleaseCallBack); - console.log(`FMS_releaseForm_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "releaseForm" : true, - "releaseId" : "0", - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_releaseForm_0500 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.host A create a formA - * 2.host B release the formA - * 2.Verify the result is false - */ - it(`FMS_releaseForm_0500`, 0, async (done) => { - console.log(`FMS_releaseForm_0500 start`); - let formId; - - function onReleasedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0500 onReleasedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0500")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_releaseForm_0500", done)); - } - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0500 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_0500")); - formId = data.data; - commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); - console.log(`FMS_releaseForm_0500 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostd", - abilityName: "com.ohos.st.formsystemhostd.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "releaseForm" : true, - "releaseId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0500 featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_releaseForm_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_releaseForm_0600 - * @tc.name: Form ID error (FormID does not exist) - * @tc.desc: 1.host create one normal card - * 2.host delete the form - * 3.host release the form and verify the result is false - */ - it(`FMS_releaseForm_0600`, 0, async (done) => { - console.log(`FMS_releaseForm_0600 start`); - let formId; - - function onReleasedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0600 onReleasedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0600")); - let commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_releaseForm_0600", done)); - } - function onDeletedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_0600 onDeletedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnDeleted_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnDeleted, unsubscribeDeletedCallback) - formId = data.parameters.formId; - commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); - - console.log(`FMS_releaseForm_0600 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "releaseForm" : true, - "releaseId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0600 featureAbility.startAbility again end`); - } - function unsubscribeDeletedCallback() { - console.debug("====>FMS_releaseForm_0600 unsubscribeDeletedCallback====>"); - } - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallBack); - console.log(`FMS_releaseForm_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "deleteForm" : true, - "deleteId" : "self", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_0600 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_releaseForm_1300 - * @tc.name: single host continuously release forms - * @tc.desc: 1.There are 2 forms created by the single host - * 2.single host release 2 forms successfully - */ - it(`FMS_releaseForm_1300`, 0, async (done) => { - console.log(`FMS_releaseForm_1300 start`); - let formIdList = []; - let releasedIdList = []; - let formCount = 2; - let delCount = 0; - - function delPublishCallBack() { - console.info("!!!====>FMS_releaseForm_1300 delPublishCallBack====>"); - delCount++; - if(delCount == formCount) { - setTimeout(function () { - console.info('FMS_releaseForm_1300 delPublishCallBack end'); - console.log(`FMS_releaseForm_1300 end`); - done(); - }, 1000); - } - } - - function onReleasedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_1300 onReleasedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data).assertEqual("0"); - let formId = data.parameters.formId; - formIdList.forEach(function(item, index, arr) { - if(item === formId) { - releasedIdList.push(formId); - } - }); - if(releasedIdList.length == formCount) { - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_1300")); - for(var iIndex = 0; iIndex < releasedIdList.length; iIndex++) { - let commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: releasedIdList[iIndex] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - } - } - } - function releaseForms() { - console.debug("====>FMS_releaseForm_1300 releaseForms====>"); - commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); - for(var iIndex = 0; iIndex < formIdList.length; iIndex++) { - console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "releaseForm" : true, - "releaseId" : formIdList[iIndex], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); - } - } - function onAcquiredCallBack1(_, data) { - console.info("!!!====>FMS_releaseForm_1300 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_1300")); - formIdList.push(data.data); - - releaseForms(); - } - - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_1300 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_1300")); - formIdList.push(data.data); - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack1); - - console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - - console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_releaseForm_1400 - * @tc.name: release temp form - * @tc.desc: 1.host create one temp form - * 2.release the form and judge the result is true - */ - it(`FMS_releaseForm_1400`, 0, async (done) => { - console.log(`FMS_releaseForm_1400 start`); - - function onReleasedCallBack(_, data) { - console.info("!!!====>FMS_releaseForm_1400 onReleasedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_1400")); - - let commonEventPublishData = { - bundleName: "com.ohos.st.formsystemhostc", - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, (delPublishCallBack("FMS_releaseForm_1400", done))); - } - commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); - - console.log(`FMS_releaseForm_1400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostc", - abilityName: "com.ohos.st.formsystemhostc.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : true, - "releaseForm" : true, - "releaseId" : "self", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_releaseForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_releaseForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_releaseForm_1400 featureAbility.startAbility end`); - }); - }); -} - -const delPublishCallBack = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnReleasedCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnReleasedCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/BUILD.gn deleted file mode 100644 index 07806903ba0e655ef1d0f11ef82a2c945b608d31..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/BUILD.gn +++ /dev/null @@ -1,32 +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("FormStateDisableTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormStateDisableTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/Test.json deleted file mode 100644 index 3b44f31aeaca6f2ba3ae5eaf627a6f937441ce9e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/Test.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formstatedisabletest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormStateDisableTest.hap", - "FormSystemHostF.hap", - "FormSystemHostG.hap", - "FormSupplyAppA.hap", - "FormSupplyAppF.hap", - "FormSupplyAppG.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppH.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json deleted file mode 100644 index f70589e2662f6d5fda35341262b71627a2ac1c60..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formstatedisabletest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formstatedisabletest", - "name": ".FormStateSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent", - "reason": "need use OnDeleted commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent", - "reason": "need use OnState commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 0d531eff10a6aaa0e89517f397aea3c59d8b558f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 30000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets deleted file mode 100644 index ef9cb318bb62c3af67354a027368eb4437111ddb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets +++ /dev/null @@ -1,783 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; - -var onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; - -var onStateFormEvent = { - events: ["FMS_FormOnState_commonEvent"], -}; - -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnAcquired; -var subscriberDel; -var subscriberOnState; -var subscriberSupply; - -export default function test() { - describe(`FmsStateFormTest`, () => { - - beforeAll(async (done) => { - done(); - }) - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberDel = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }) - - /** - * @tc.number: FMS_disableFormsUpdate_0200 - * @tc.name: The form user does not have permission. - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0200`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_0200 start`); - function onStateCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0200 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("2"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0200")); - setTimeout(function () { - console.info('FMS_disableFormsUpdate_0200 onStateCallBack end'); - console.log(`FMS_disableFormsUpdate_0200 end`); - done(); - }, 1000) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : ["1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbility again end`); - }); - /** - * @tc.number: FMS_disableFormsUpdate_0300 - * @tc.name: The length of the formId list is 0 (no formId) - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0300`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_0300 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0300 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("7"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0300")) - - setTimeout(function () { - console.info('FMS_disableFormsUpdate_0300 delPublishCallBack end'); - console.log(`FMS_disableFormsUpdate_0300 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : [], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate _0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_disableFormsUpdate_0400 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0400`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_0400 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0400 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0400")) - - setTimeout(function () { - console.info('FMS_disableFormsUpdate_0400 delPublishCallBack end'); - console.log(`FMS_disableFormsUpdate_0400 end`); - done(); - }, 100) - } - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : ["-1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate _0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_disableFormsUpdate_0500 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0500`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_0500 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0500 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0500")) - - setTimeout(function () { - console.info('FMS_disableFormsUpdate_0500 delPublishCallBack end'); - console.log(`FMS_disableFormsUpdate_0500 end`); - done(); - }, 100) - } - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : ["0"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_disableFormsUpdate_0600 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0600`, 0, async (done) => { - console.info(`FMS_disableFormsUpdate_0600 start`); - let hostFormId; - - const onDisableCallback = (_, data) => { - if (data.parameters.kind != "disable") { - return; - } - console.debug("====>FMS_disableFormsUpdate_0600 onDisableCallback data:====>" + JSON.stringify(data)); - - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnDisableCallback("FMS_disableFormsUpdate_0600")); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_disableFormsUpdate_0600")); - const commonEventPublishData = { - data: hostFormId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_disableFormsUpdate_0600", done)); - } - - const onAcquiredCallBack = async (_, data) => { - console.debug("====>FMS_disableFormsUpdate_0600 onAcquiredCallback data:====>" + JSON.stringify(data)); - hostFormId = data.data; - - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": hostFormId, - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "disable", - "stateIds": [hostFormId], - "isCreate": false - } - } - }).then((res: any) => { - console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_disableFormsUpdate_0600")); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - commonEvent.subscribe(subscriberOnState, onDisableCallback); - console.info(`FMS_disableFormsUpdate_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - /** - * @tc.number: FMS_disableFormsUpdate_0700 - * @tc.name: formID id is error because formId is not exist - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0700`, 0, async (done) => { - console.info(`FMS_disableFormsUpdate_0700 start`); - let hostFormId; - - const onDisableCallback = (_, data) => { - if (data.parameters.kind != "disable") { - return; - } - console.debug("====>FMS_disableFormsUpdate_0700 onDisableCallback data:====>" + JSON.stringify(data)); - - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => { - console.info("====>FMS_disableFormsUpdate_0700 unSubscribeOnDisableCallback====>"); - }); - done(); - } - - const onDeleteCallback = async (_, data) => { - console.debug("====>FMS_disableFormsUpdate_0700 onDeleteCallback data:====>" + JSON.stringify(data)); - hostFormId = data.parameters.formId; - - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "disable", - "stateIds": [hostFormId], - "isCreate": false - } - } - }).then((res: any) => { - console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - commonEvent.unsubscribe(subscriberDel, () => { - console.info("====>FMS_disableFormsUpdate_0700 unSubscribeDelCallback====>"); - }); - } - - commonEvent.subscribe(subscriberDel, onDeleteCallback); - commonEvent.subscribe(subscriberOnState, onDisableCallback); - console.info(`FMS_disableFormsUpdate_0700 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "deleteForm": true, - "deleteId": "self", - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - /** - * @tc.number: FMS_disableFormsUpdate_0800 - * @tc.name: The form user has form permission. - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0800`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_0800 start`); - let formId; - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0800 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - formId = data.parameters.formId; - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0800")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_disableFormsUpdate_0800", done)); - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_disableFormsUpdate_0900 - * @tc.name: There are correct and wrong formId in the form ID parameter list. - * @tc.desc: 1.The form user calls the disable update interface. - * 2.Verify the result of the disable update interface. - */ - it(`FMS_disableFormsUpdate_0900`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_0900 start`); - let formId; - - function OnDisableCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0900 OnDisableCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnDisableCallback("FMS_disableFormsUpdate_0900")); - - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_disableFormsUpdate_0900", done)); - } - async function OnEnableCallBack(_, data) { - console.info("!!!====>FMS_disableFormsUpdate_0900 OnEnableCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnEnableCallback("FMS_disableFormsUpdate_0900")); - formId = data.parameters.formId; - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, OnDisableCallBack); - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : [formId, "0"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility end`); - } - - commonEvent.subscribe(subscriberOnState, OnEnableCallBack); - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_disableFormsUpdate_1000 - * @tc.name: Set next refresh time is invalid when disable form. (cache data < 1k) - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Call the disableFormsUpdate interface. - * 3.Call the setFormNextRefreshTime interface and verify the form can not refresh. - */ - it(`FMS_disableFormsUpdate_1000`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_1000 start`); - let formId; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 100 }, () => { - console.log(`FMS_disableFormsUpdate_1000 time speed up`); - }); - - function onSupplyEventCallBack(_, data) { - console.debug("====>FMS_disableFormsUpdate_1000 onSupplyEventCallBack====>" + JSON.stringify(data)); - if ("onUpdate" == data.parameters.kind) { - console.debug("FMS_disableFormsUpdate_1000 error, onUpdate called."); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); - expect().assertFail(); - } - } - - function onFormDisableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_disableFormsUpdate_1000 onFormDisableCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); - expect(data.parameters.kind).assertEqual("disable"); - expect(data.data).assertEqual("0"); - - commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); - - setTimeout(() => { - // timer reset - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.log(`FMS_disableFormsUpdate_1000 time reset`); - }); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); - }, 9000); - - setTimeout(() => { - console.log(`FMS_disableFormsUpdate_1000 onFormDisableCallBack end`); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_disableFormsUpdate_1000", done)); - }, 10000); - } - - async function onAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); - console.debug("====>FMS_disableFormsUpdate_1000 onAcquiredCallBack====>" + JSON.stringify(data)); - expect(data.parameters.kind).assertEqual("visible"); - expect(data.data).assertEqual("0"); - formId = data.parameters.formId; - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility notify disable start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : [formId], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility notify disable end`); - } - - commonEvent.subscribe(subscriberOnState, onAcquiredCallBack); - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicef.hmservice", - "ability" : "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true, - "stateIds" : ["self"], - "stateForm" : "visible" - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility servicea end`); - }); - - /** - * @tc.number: FMS_disableFormsUpdate_1100 - * @tc.name: Set next refresh time is invalid when disable form. (cache data > 1k) - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Call the disableFormsUpdate interface. - * 3.Call the setFormNextRefreshTime interface and verify the form can not refresh. - */ - it(`FMS_disableFormsUpdate_1100`, 0, async (done) => { - console.log(`FMS_disableFormsUpdate_1100 start`); - let formId; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 100 }, () => { - console.log(`FMS_disableFormsUpdate_1100 time speed up`); - }); - - function onSupplyEventCallBack(_, data) { - console.debug("====>FMS_disableFormsUpdate_1100 onSupplyEventCallBack====>" + JSON.stringify(data)); - if ("onUpdate" == data.parameters.kind) { - console.debug("FMS_disableFormsUpdate_1100 error, onUpdate called."); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); - expect().assertFail(); - } - } - - function onFormDisableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_disableFormsUpdate_1100 onFormDisableCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); - expect(data.parameters.kind).assertEqual("disable"); - expect(data.data).assertEqual("0"); - - commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); - - setTimeout(() => { - // timer reset - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.log(`FMS_disableFormsUpdate_1100 time reset`); - }); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); - }, 9000); - - setTimeout(() => { - console.log(`FMS_disableFormsUpdate_1100 onFormDisableCallBack end`); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_disableFormsUpdate_1100", done)); - }, 10000); - } - - async function onAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); - console.debug("====>FMS_disableFormsUpdate_1100 onAcquiredCallBack====>" + JSON.stringify(data)); - expect(data.parameters.kind).assertEqual("visible"); - expect(data.data).assertEqual("0"); - formId = data.parameters.formId; - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility notify disable start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : [formId], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility notify disable end`); - } - - commonEvent.subscribe(subscriberOnState, onAcquiredCallBack); - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviceg.hmservice", - "ability" : "com.form.formsystemtestserviceg.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true, - "stateIds" : ["self"], - "stateForm" : "visible" - } - } - }).then((res: any) => { - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility servicea end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnStateCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); -} - -const unsubscribeOnDisableCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnDisableCallback====>`); -} - -const unsubscribeOnEnableCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnEnableCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index ea2d993ef471e94f437059ae3dc201568b7e3f2b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsFormStateDisable.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 95817e60f50f5e4b3c91da7e64febe07c2426751..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formdisablestatetest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/BUILD.gn deleted file mode 100644 index 55ea97b27b1c070786607f7b766cc474fe3ef2fa..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/BUILD.gn +++ /dev/null @@ -1,32 +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("FormStateEnableTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormStateEnableTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json deleted file mode 100644 index ef414613eae6a9d9341772eac9415803c2f70642..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formstateenabletest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormStateEnableTest.hap", - "FormSystemHostF.hap", - "FormSystemHostG.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap", - "FormSupplyAppE.hap", - "FormSupplyAppF.hap", - "FormSupplyAppH.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json deleted file mode 100644 index 60cf1e361f154ae142dae1d26a1f19909a807846..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formstateenabletest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formstateenabletest", - "name": ".FormStateSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent", - "reason": "need use OnDeleted commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent", - "reason": "need use OnState commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 0d531eff10a6aaa0e89517f397aea3c59d8b558f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 30000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets deleted file mode 100644 index 246f710b4aa4edc4952db2c52063e719ab787a2e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets +++ /dev/null @@ -1,898 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; - -var onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; - -var onStateFormEvent = { - events: ["FMS_FormOnState_commonEvent"], -}; - -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnAcquired; -var subscriberDel; -var subscriberOnState; -var subscriberSupply; - -export default function test() { - describe(`FmsStateFormTest`, () => { - - beforeAll(async (done) => { - done(); - }) - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberDel = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }) - - /** - * @tc.number: FMS_enableFormsUpdate_0200 - * @tc.name: The form user does not have permission. - * @tc.desc: 1.The form user calls the enable update interface. - * 2.Verify the result of the enable update interface. - */ - it(`FMS_enableFormsUpdate_0200`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_0200 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_enableFormsUpdate_0200 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("2"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0200")); - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0200 onStateCallBack end'); - console.log(`FMS_enableFormsUpdate_0200 end`); - done(); - }, 1000); - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : ["1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbility again end`); - }); - /** - * @tc.number: FMS_enableFormsUpdate_0300 - * @tc.name: The length of the formId list is 0 (no formId) - * @tc.desc: 1.The form user calls the enable update interface. - * 2.Verify the result of the enable update interface. - */ - it(`FMS_enableFormsUpdate_0300`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_0300 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_enableFormsUpdate_0300 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("7"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0300")) - - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0300 delPublishCallBack end'); - console.log(`FMS_enableFormsUpdate_0300 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : [], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_enableFormsUpdate_0400 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form user calls the enable update interface. - * 2.Verify the result of the enable update interface. - */ - it(`FMS_enableFormsUpdate_0400`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_0400 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_enableFormsUpdate_0400 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0400")) - - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0400 delPublishCallBack end'); - console.log(`FMS_enableFormsUpdate_0400 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : ["-1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_enableFormsUpdate_0500 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form user calls the enable update interface. - * 2.Verify the result of the enable update interface. - */ - it(`FMS_enableFormsUpdate_0500`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_0500 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_enableFormsUpdate_0500 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0500")) - - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0500 delPublishCallBack end'); - console.log(`FMS_enableFormsUpdate_0500 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : ["0"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_enableFormsUpdate_0600 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form user calls the enable update interface. - * 2.Verify the result of the enable update interface. - */ - it(`FMS_enableFormsUpdate_0600`, 0, async (done) => { - console.info(`FMS_enableFormsUpdate_0600 start`); - let hostFormId; - - const onEnableCallback = (_, data) => { - if (data.parameters.kind != "enable") { - return; - } - console.debug("====>FMS_enableFormsUpdate_0600 onEnableCallback data:====>" + JSON.stringify(data)); - - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0600")); - const commonEventPublishData = { - data: hostFormId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_enableFormsUpdate_0600", done)); - } - - const onAcquiredCallBack = async (_, data) => { - console.debug("====>FMS_enableFormsUpdate_0600 onAcquiredCallback data:====>" + JSON.stringify(data)); - hostFormId = data.data; - - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": hostFormId, - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "enable", - "stateIds": [hostFormId], - "isCreate": false - } - } - }).then((res: any) => { - console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_enableFormsUpdate_0600")); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - commonEvent.subscribe(subscriberOnState, onEnableCallback); - console.info(`FMS_enableFormsUpdate_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - /** - * @tc.number: FMS_enableFormsUpdate_0700 - * @tc.name: formID id is error because formId is not exist - * @tc.desc: 1.The form user calls the enable update interface. - * 2.Verify the result of the enable update interface. - */ - it(`FMS_enableFormsUpdate_0700`, 0, async (done) => { - console.info(`FMS_enableFormsUpdate_0700 start`); - let hostFormId; - - const onEnableCallback = (_, data) => { - if (data.parameters.kind != "enable") { - return; - } - console.debug("====>FMS_enableFormsUpdate_0700 onEnableCallback data:====>" + JSON.stringify(data)); - - expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => { - console.info("====>FMS_enableFormsUpdate_0700 unSubscribeOnEnableCallback====>"); - }); - done(); - } - - const onDeleteCallback = async (_, data) => { - console.debug("====>FMS_enableFormsUpdate_0700 onDeleteCallback data:====>" + JSON.stringify(data)); - hostFormId = data.parameters.formId; - - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "enable", - "stateIds": [hostFormId], - "isCreate": false - } - } - }).then((res: any) => { - console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - commonEvent.unsubscribe(subscriberDel, () => { - console.info("====>FMS_enableFormsUpdate_0700 unSubscribeDelCallback====>"); - }); - } - - commonEvent.subscribe(subscriberDel, onDeleteCallback); - commonEvent.subscribe(subscriberOnState, onEnableCallback); - console.info(`FMS_enableFormsUpdate_0700 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "deleteForm": true, - "deleteId": "self", - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - - /** - * @tc.number: FMS_enableFormsUpdate_0900 - * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_enableFormsUpdate_0900`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_0900 start`); - let formIds = []; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 300 }, () => { - console.log(`FMS_enableFormsUpdate_0900 time speed up`); - }); - - function onUpdateCallBack(_, data) { - if (data.parameters.kind == "onUpdate") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_0900 onUpdateCallBack====>" + JSON.stringify(data)); - expect(data.parameters.parameters).assertEqual(formIds[0]); - - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); - - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.log(`FMS_enableFormsUpdate_0900 time reset`); - }); - - setTimeout(() => { - let commonEventPublishData = { - data: formIds[0] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_enableFormsUpdate_0900", done)); - }, 2000); - } - } - - function onFormEnableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_0900 onFormEnableCallBack====>" + JSON.stringify(data)); - expect(data.parameters.formId).assertEqual(formIds[0]); - expect(data.parameters.kind).assertEqual("enable"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); - } - - async function onFormDisableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_0900 onFormDisableCallBack====>" + JSON.stringify(data)); - expect(data.parameters.formId).assertEqual(formIds[0]); - expect(data.parameters.kind).assertEqual("disable"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, onFormEnableCallBack); - commonEvent.subscribe(subscriberSupply, onUpdateCallBack); - - setTimeout(async () => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notifyVisible start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notifyVisible end`); - }, 10000); - } - - async function onAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); - console.debug("====>FMS_enableFormsUpdate_0900 onAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - - commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notify disable start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notify disable end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicee.hmservice", - "ability" : "com.form.formsystemtestservicee.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility servicea end`); - }); - - /** - * @tc.number: FMS_enableFormsUpdate_1000 - * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_enableFormsUpdate_1000`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_1000 start`); - let formIds = []; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 300 }, () => { - console.log(`FMS_enableFormsUpdate_1000 time speed up`); - }); - - function onUpdateCallBack(_, data) { - if (data.parameters.kind == "onUpdate") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_1000 onUpdateCallBack====>" + JSON.stringify(data)); - expect(data.parameters.parameters).assertEqual(formIds[0]); - - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); - - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.log(`FMS_enableFormsUpdate_1000 time reset`); - }); - - setTimeout(() => { - let commonEventPublishData = { - data: formIds[0] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_enableFormsUpdate_1000", done)); - }, 2000); - } - } - - function onFormEnableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_1000 onFormEnableCallBack====>" + JSON.stringify(data)); - expect(data.parameters.formId).assertEqual(formIds[0]); - expect(data.parameters.kind).assertEqual("enable"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); - } - - async function onFormDisableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_1000 onFormDisableCallBack====>" + JSON.stringify(data)); - expect(data.parameters.formId).assertEqual(formIds[0]); - expect(data.parameters.kind).assertEqual("disable"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, onFormEnableCallBack); - commonEvent.subscribe(subscriberSupply, onUpdateCallBack); - - setTimeout(async () => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notifyVisible start`); - formIds.push("0"); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notifyVisible end`); - }, 10000); - } - - function onAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); - console.debug("====>FMS_enableFormsUpdate_1000 onAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notify disable start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notify disable end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicee.hmservice", - "ability" : "com.form.formsystemtestservicee.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility servicea end`); - }); - - /** - * @tc.number: FMS_enableFormsUpdate_1200 - * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be visible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_enableFormsUpdate_1200`, 0, async (done) => { - console.log(`FMS_enableFormsUpdate_1200 start`); - let formIds = new Array(); - let count = 0; - - // timer speed up - commonEvent.publish(`fms.time_speed`, { code: 300 }, () => { - console.log(`FMS_enableFormsUpdate_1200 time speed up`); - }); - - function delPublishCallBack1(_, data) { - console.info("!!!====>FMS_enableFormsUpdate_1200 delPublishCallBack1====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_enableFormsUpdate_1200 delPublishCallBack1 end'); - console.log(`FMS_enableFormsUpdate_1200 end`); - }, 1000); - } - function delPublishCallBack2(_, data) { - console.info("!!!====>FMS_enableFormsUpdate_1200 delPublishCallBack2====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_enableFormsUpdate_1200 delPublishCallBack2 end'); - console.log(`FMS_enableFormsUpdate_1200 end`); - done(); - }, 1000); - } - - function onUpdateCallBack(_, data) { - if (data.parameters.kind == "onUpdate") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_1200 onUpdateCallBack====>" + JSON.stringify(data)); - expect(formIds.includes(data.parameters.parameters)).assertEqual(true); - - ++count; - if (count == 2) { - console.debug("====>FMS_enableFormsUpdate_1200 OK====>"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); - - commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { - console.log(`FMS_enableFormsUpdate_1200 time reset`); - }); - - setTimeout(() => { - let commonEventPublishData1 = { - data: formIds[0] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); - let commonEventPublishData2 = { - data: formIds[1] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); - }, 2000); - } - } - } - - function onFormEnableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_1200 onFormEnableCallBack====>" + JSON.stringify(data)); - expect(data.parameters.kind).assertEqual("enable"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); - } - - async function onFormDisableCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - console.debug("====>FMS_enableFormsUpdate_1200 onFormDisableCallBack====>" + JSON.stringify(data)); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, onFormEnableCallBack); - commonEvent.subscribe(subscriberSupply, onUpdateCallBack); - setTimeout(async () => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notifyVisible start`); - formIds.push("0"); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "enable", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notifyVisible end`); - }, 10000); - } - - async function onSecondAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); - console.debug("====>FMS_enableFormsUpdate_1200 onSecondAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - console.debug("====>FMS_enableFormsUpdate_1200 formIds====>" + formIds); - - commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); - - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notify disable start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "disable", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notify disable end`); - } - - async function onFirstAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); - console.debug("====>FMS_enableFormsUpdate_1200 onFirstAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onSecondAcquiredCallBack); - - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility serviceb start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviceh.hmservice", - "ability" : "com.form.formsystemtestserviceh.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility serviceb end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onFirstAcquiredCallBack); - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicee.hmservice", - "ability" : "com.form.formsystemtestservicee.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility servicea end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnStateCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 076280f4627a9d8c5b7f4b7b9f777d2765f6ee7b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsFormStateEnable.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/element/string.json deleted file mode 100644 index d3a7164e21e4424a760d0def485e031e668883ed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formenablestatetest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn deleted file mode 100644 index 5030bc71b9ace589ff82276ed292995bf3bd3ea0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn +++ /dev/null @@ -1,32 +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("FormStateNotifyInvisibleTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormStateNotifyInvisibleTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json deleted file mode 100644 index 93b5de06d41f58556eb2486c39b1bc34d2be7c92..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formstatenotifyinvisibletest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormStateNotifyInvisibleTest.hap", - "FormSystemHostF.hap", - "FormSystemHostG.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap", - "FormSupplyAppF.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json deleted file mode 100644 index ce10856f7c7998ea4b17818efc01aa08b47c4330..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formstatenotifyinvisibletest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formstatenotifyinvisibletest", - "name": ".FormStateSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent", - "reason": "need use OnDeleted commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent", - "reason": "need use OnState commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 07cb76f5af58c6f15b68bfaa8a7402c4a5c9252f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 10000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets deleted file mode 100644 index af81352ba04f5577dca1bb93ffa5106f1f1641ff..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets +++ /dev/null @@ -1,538 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { describe, beforeEach, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; - -var onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; - -var onStateFormEvent = { - events: ["FMS_FormOnState_commonEvent"], -}; - -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnAcquired; -var subscriberDel; -var subscriberOnState; -var subscriberSupply; - -export default function test() { - describe(`FmsStateFormTest`, () => { - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberDel = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }) - - /** - * @tc.number: FMS_notifyInvisibleForms_0200 - * @tc.name: The form user does not have permission. - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0200`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0200 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0200 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("2"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0200")); - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_0200 onStateCallBack end'); - console.log(`FMS_notifyInvisibleForms_0200 end`); - done(); - }, 1000) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : ["1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbility again end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_0300 - * @tc.name: The length of the formId list is 0 (no formId) - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0300`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0300 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0300 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("7"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0300")) - - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_0300 delPublishCallBack end'); - console.log(`FMS_notifyInvisibleForms_0300 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_0400 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0400`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0400 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0400 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0400")) - - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_0400 delPublishCallBack end'); - console.log(`FMS_notifyInvisibleForms_0400 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : ["-1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_0500 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0500`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0500 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0500 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0500")) - - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_0500 delPublishCallBack end'); - console.log(`FMS_notifyInvisibleForms_0500 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : ["0"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_0600 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0600`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0600 start`); - let formId; - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0600 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0600")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyInvisibleForms_0600", done)); - } - - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0600 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyInvisibleForms_0600")) - formId = data.data; - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [formId], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_0700 - * @tc.name: form has been deleted - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0700`, 0, async (done) => { - console.info(`FMS_notifyInvisibleForms_0700 start`); - let hostFormId; - - const onSupplyCallback = (_, data) => { - if (data.parameters.kind != "onVisibilityChange") { - return; - } - console.debug("====>FMS_notifyInvisibleForms_0700 onSupplyCallback data:====>" + JSON.stringify(data)); - expect().assertFail(); - } - - const onInvisibleCallback = (_, data) => { - if (data.parameters.kind != "invisible") { - return; - } - console.debug("====>FMS_notifyInvisibleForms_0700 onInvisibleCallback data:====>" + JSON.stringify(data)); - - expect(data.data).assertEqual("0"); - expect(data.parameters.formId).assertEqual(hostFormId); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0700")); - setTimeout(() => { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_0700")); - done(); - }, 2000); - } - - const onDeleteCallback = async (_, data) => { - console.debug("====>FMS_notifyInvisibleForms_0700 onDeleteCallback data:====>" + JSON.stringify(data)); - hostFormId = data.parameters.formId; - - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "invisible", - "stateIds": [hostFormId], - "isCreate": false - } - } - }).then((res: any) => { - console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - commonEvent.unsubscribe(subscriberDel, () => { - console.info("====>FMS_notifyInvisibleForms_0700 unSubscribeDelCallback====>"); - }); - } - - commonEvent.subscribe(subscriberDel, onDeleteCallback); - commonEvent.subscribe(subscriberOnState, onInvisibleCallback); - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - console.info(`FMS_notifyInvisibleForms_0700 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "deleteForm": true, - "deleteId": "self", - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_0800 - * @tc.name: The form provider is the system application and config When form visiblenotify is true, - * the form provider can be notified that the form is invisible. - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0800`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0800 start`); - let formIdInvisible; - let formIdVisible; - let onSupplyCount = 0; - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyInvisibleForms_0800 onSupplyCallBack====>" + JSON.stringify(data)); - onSupplyCount++; - if (onSupplyCount == 2) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_0800")); - } - if (formIdInvisible && formIdVisible) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyInvisibleForms_0800", done)); - } - } - } - - function OnInvisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0800 OnInvisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - formIdInvisible = data.parameters.formId; - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0800")); - if (formIdInvisible && formIdVisible && onSupplyCount == 2) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyInvisibleForms_0800", done)); - } - } - async function onVisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0800 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0800")); - formIdVisible = data.parameters.formId; - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [formIdVisible], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnStateCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 03a00d6756631044e1b817a0449f5617a2a8daef..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsFormStateNotifyInvisible.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 3c18b675c9487847c521511cecb69a29dc08821c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "forminvisiblestatetest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn deleted file mode 100644 index ca89869b71f573dc5ec998b200b063ac83574af9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn +++ /dev/null @@ -1,32 +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("FormStateNotifyInvisibleTest2") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormStateNotifyInvisibleTest2" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json deleted file mode 100644 index 0d62b5f0ae620c4a51711445941c97918969d264..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formstatenotifyinvisibletest2", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormStateNotifyInvisibleTest2.hap", - "FormSystemHostG.hap", - "FormSupplyAppA.hap", - "FormSupplyAppB.hap", - "FormSupplyAppD.hap", - "FormSupplyAppF.hap", - "FormSupplyAppNS.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json deleted file mode 100644 index 27a08f66e7e762081dc6b8e2b7918f55e8ef61d9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formstatenotifyinvisibletest2", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formstatenotifyinvisibletest2", - "name": ".FormStateSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent", - "reason": "need use OnDeleted commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent", - "reason": "need use OnState commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 07cb76f5af58c6f15b68bfaa8a7402c4a5c9252f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 10000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets deleted file mode 100644 index da278396cffc6f67106709ef9fc44449c71c35cb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets +++ /dev/null @@ -1,817 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; - -var onStateFormEvent = { - events: ["FMS_FormOnState_commonEvent"], -}; - -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnAcquired; -var subscriberOnState; -var subscriberSupply; - -export default function test() { - - describe(`FmsStateFormTest`, () => { - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }) - - /** - * @tc.number: FMS_notifyInvisibleForms_0900 - * @tc.name: There are correct and wrong formId in the form ID parameter list - * that informs that the form is invisible. - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_0900`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_0900 start`); - let formIdInvisible; - let formIdVisible; - let onSupplyCount = 0; - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyInvisibleForms_0900 onSupplyCallBack====>" + JSON.stringify(data)); - onSupplyCount++; - if (onSupplyCount == 2) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_0900")); - } - if (formIdInvisible && formIdVisible) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyInvisibleForms_0900", done)); - } - } - } - - function OnInvisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0900 OnInvisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - formIdInvisible = data.parameters.formId; - commonEvent.unsubscribe(subscriberOnState, unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0900")); - if (formIdInvisible && formIdVisible && onSupplyCount == 2) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyInvisibleForms_0900", done)); - } - } - async function onVisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_0900 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0900")); - formIdVisible = data.parameters.formId; - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [formIdVisible, "0"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_1000 - * @tc.name: When the form provider is not a system application, notify the form to be invisible - * and do not pull up the form provider. - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_1000`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_1000 start`); - - function onVisibleCallBack(_, data) { - if (data.parameters.kind != "invisible") { - return; - } - console.info("!!!====>FMS_notifyInvisibleForms_1000 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - - setTimeout(function () { - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1000")); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1000")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyInvisibleForms_0900", done)); - }, 2000); - } - function onSupplyEventCallBack(_, data) { - if (data.parameters.kind != "onVisibilityChange") { - return; - } - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1000")); - console.debug("====>FMS_notifyInvisibleForms_1000 onSupplyEventCallBack====>" + JSON.stringify(data)); - console.log(`FMS_notifyInvisibleForms_1000 error`); - expect().assertFail(); - } - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); - console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicenotsysapp.hmservice", - "ability" : "com.form.formsystemtestservicenotsysapp.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_1100 - * @tc.name: When formVisibleNotify is false in config.json, - * the form provider will not be pulled when the card is invisible. - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_1100`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_1100 start`); - let supplyFlag = false; - let formIdInvisible; - let formIdVisible; - - function delPublishCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1100 delPublishCallBack====>"); - setTimeout(function () { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1100")); - if (supplyFlag) { - expect().assertFail(); - } - console.info('FMS_notifyInvisibleForms_1100 delPublishCallBack end'); - console.log(`FMS_notifyInvisibleForms_1100 end`); - done(); - }, 1000); - } - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyInvisibleForms_1100 onSupplyCallBack====>" + JSON.stringify(data)); - supplyFlag = true; - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1100")); - - if (formIdInvisible && formIdVisible) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - } - } - } - - function OnInvisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1100 OnInvisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - formIdInvisible = data.parameters.formId; - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1100")); - if (formIdInvisible && formIdVisible) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - } - } - async function onVisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1100 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1100")); - formIdVisible = data.parameters.formId; - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); - - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviced.hmservice", - "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [formIdVisible], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviced.hmservice", - "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_1200 - * @tc.name: When formVisibleNotify in config.json is true, - * the provider can be notified of the visibility of the form. - * @tc.desc: 1. The form is created successfully. - * 2. The invisible interface is invoked successfully, - * and the visibility notification of form providers A and B is triggered. - * The formId is the same as the created formId, and the visibility status is invisible. - */ - it(`FMS_notifyInvisibleForms_1200`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_1200 start`); - let formId1; - let formId2; - let delCount = 0; - let onSupplyCount = 0; - - function delPublishCallBack() { - console.info("!!!====>FMS_notifyInvisibleForms_1200 delPublishCallBack====>"); - delCount++; - if (delCount == 2) { - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_1200 delPublishCallBack end'); - console.info('FMS_notifyInvisibleForms_1200 end'); - done(); - }, 500); - } - } - function onAcquiredCallBack_Normal1(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1200 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) - formId1 = data.data; - - FMS_notifyInvisibleForms_1200_normal2(); - } - function unSubscribeOnAcquiredCallBack_Normal1() { - console.debug("====>FMS_notifyInvisibleForms_1200 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"); - } - - async function FMS_notifyInvisibleForms_1200_normal1() { - console.log(`FMS_notifyInvisibleForms_1200_normal1 start`); - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); - console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility end`); - console.log(`FMS_notifyInvisibleForms_1200_normal1 end`); - } - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1200")) - console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack formId1:====>" + formId1); - console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack formId2:====>" + formId2); - console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack onSupplyCount:====>" + onSupplyCount); - if (formId1 && formId2 && onSupplyCount == 2) { - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - let commonEventPublishData2 = { - data: formId2 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); - } - } - - async function onAcquiredCallBack_Normal2(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1200 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2); - formId2 = data.data; - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [formId1, formId2], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbility end`); - } - function unSubscribeOnAcquiredCallBack_Normal2() { - console.debug("====>FMS_notifyInvisibleForms_1200 unSubscribeOnAcquiredCallBack_Normal2====>"); - } - async function FMS_notifyInvisibleForms_1200_normal2() { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); - console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviceb.hmservice", - "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility end`); - } - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyInvisibleForms_1200 onSupplyCallBack====>" + JSON.stringify(data)); - let parameters = JSON.parse(data.parameters.parameters); - if(parameters[formId1]) { - expect(parameters[formId1]).assertEqual(2); - } - if(parameters[formId2]) { - expect(parameters[formId2]).assertEqual(2); - } - - onSupplyCount++; - if (onSupplyCount == 2) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1200")); - } - if (formId1 && formId2) { - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - let commonEventPublishData2 = { - data: formId2 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); - } - } - } - - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - FMS_notifyInvisibleForms_1200_normal1(); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_1300 - * @tc.name: When formVisibleNotify is true in config.json, - * the form provider will be pulled when the card is invisible. - * @tc.desc: 1.The form user calls the invisible notification interface. - * 2.Verify the result of the invisible notification interface. - */ - it(`FMS_notifyInvisibleForms_1300`, 0, async (done) => { - console.info(`FMS_notifyInvisibleForms_1300 start`); - let hostFormId; - let providerFormId; - let counter = 0; - - const delPublishCallback = (_, data) => { - console.info("!!!====>FMS_notifyInvisibleForms_1300 delPublishCallback====>"); - setTimeout(() => { - expect(hostFormId).assertEqual(providerFormId); - console.info('FMS_notifyInvisibleForms_1300 delPublishCallback end'); - console.info(`FMS_notifyInvisibleForms_1300 end`); - done(); - }, 1000); - } - - const onSupplyCallback = (_, data) => { - if (data.parameters.kind != "onVisibilityChange") { - return; - } - console.debug("====>FMS_notifyInvisibleForms_1300 onSupplyCallback data:====>" + JSON.stringify(data)); - providerFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[providerFormId]; - - expect(visibilityStatus).assertEqual(2); - commonEvent.unsubscribe(subscriberSupply, () => { - console.info("====>FMS_notifyInvisibleForms_1300 unSubscribeSupplyCallback====>"); - }); - if (++counter == 2) { - const commonEventPublishData = { - data: providerFormId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - } - } - - const onInvisibleCallback = (_, data) => { - if (data.parameters.kind != "invisible") { - return; - } - console.debug("====>FMS_notifyInvisibleForms_1300 onInvisibleCallback data:====>" + JSON.stringify(data)); - hostFormId = data.parameters.formId; - - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => { - console.info("====>FMS_notifyInvisibleForms_1300 unSubscribeOnInvisibleCallback====>"); - }); - if (++counter == 2) { - const commonEventPublishData = { - data: hostFormId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - } - } - - commonEvent.subscribe(subscriberOnState, onInvisibleCallback); - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - console.info(`FMS_notifyInvisibleForms_1300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "invisible", - "stateIds": ["self"], - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - - /** - * @tc.number: FMS_notifyInvisibleForms_1400 - * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyInvisibleForms_1400`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_1400 start`); - let formIds = new Array(); - let count = 0; - - function delPublishCallBack1(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1400 delPublishCallBack1====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_1400 delPublishCallBack1 end'); - console.log(`FMS_notifyInvisibleForms_1400 end`); - }, 1000); - } - function delPublishCallBack2(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1400 delPublishCallBack2====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_1400 delPublishCallBack2 end'); - console.log(`FMS_notifyInvisibleForms_1400 end`); - done(); - }, 1000); - } - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyInvisibleForms_1400 onSupplyCallBack====>" + JSON.stringify(data)); - - let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; - expect(formIds.includes(retFormId)).assertTrue(); - expect(visibilityStatus).assertEqual(2); - - ++count; - if (count == 2) { - console.debug("====>FMS_notifyInvisibleForms_1400 OK====>"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1400")); - - let commonEventPublishData1 = { - data: formIds[0] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); - let commonEventPublishData2 = { - data: formIds[1] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); - } - } - } - - async function onSecondAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1400")); - console.debug("====>FMS_notifyInvisibleForms_1400 onSecondAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - formIds.push("-1"); - console.debug("====>FMS_notifyInvisibleForms_1400 formIds====>" + formIds); - - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible end`); - } - - async function onFirstAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1400")); - console.debug("====>FMS_notifyInvisibleForms_1400 onFirstAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onSecondAcquiredCallBack); - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviceb.hmservice", - "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onFirstAcquiredCallBack); - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea end`); - }); - /** - * @tc.number: FMS_notifyInvisibleForms_1500 - * @tc.name: The size of invisible form ids in the notification form array exceeds 32. - * @tc.desc: 1. Failed to invoke the invisibility interface (parameter error). - */ - it(`FMS_notifyInvisibleForms_1500`, 0, async (done) => { - console.log(`FMS_notifyInvisibleForms_1500 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyInvisibleForms_1500 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("7"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1500")) - - setTimeout(function () { - console.info('FMS_notifyInvisibleForms_1500 delPublishCallBack end'); - console.log(`FMS_notifyInvisibleForms_1500 end`); - done(); - }, 100) - } - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : [ - "1","2","3","4","5","6","7","8","9","10","11","12","13","14", - "15","16","17","18","19","20","21","22","23","24","25","26", - "27","28","29","30","31","32","33" - ], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbility end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnStateCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 6a25dbcbbd793c88e53430e39e5a434fcca648d7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsFormStateNotifyInvisible2.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 3c18b675c9487847c521511cecb69a29dc08821c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "forminvisiblestatetest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn deleted file mode 100644 index b80127f2497c2480664e4d036fcf3460e2fa314d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn +++ /dev/null @@ -1,32 +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("FormStateNotifyVisibleTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormStateNotifyVisibleTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json deleted file mode 100644 index cd0cf86a5266ba1e60636165a0fe8fdf7835dd8d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formstatenotifyvisibletest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormStateNotifyVisibleTest.hap", - "FormSystemHostF.hap", - "FormSystemHostG.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap", - "FormSupplyAppB.hap", - "FormSupplyAppD.hap", - "FormSupplyAppE.hap", - "FormSupplyAppF.hap", - "FormSupplyAppG.hap", - "FormSupplyAppH.hap", - "FormSupplyAppNS.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json deleted file mode 100644 index 1cfc6433edfb38ab9242708257892ac06db07db2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formstatenotifyvisibletest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formstatenotifyvisibletest", - "name": ".FormStateSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnState_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent", - "reason": "need use OnDeleted commonEvent" - }, - { - "name": "FMS_FormOnState_commonEvent", - "reason": "need use OnState commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 07cb76f5af58c6f15b68bfaa8a7402c4a5c9252f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 10000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets deleted file mode 100644 index 42b9c027e0db2b12c80c6e61ed62875ae70a0b98..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets +++ /dev/null @@ -1,1376 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; - -var onStateFormEvent = { - events: ["FMS_FormOnState_commonEvent"], -}; - -var onSupplyEvent = { - events: ["FMS_FormSupply_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - -var subscriberOnAcquired; -var subscriberOnState; -var subscriberSupply; - -export default function test() { - describe(`FmsStateFormTest`, () => { - - beforeAll(async (done) => { - done(); - }) - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - await sleep(1000); - }) - - - /** - * @tc.number: FMS_notifyVisibleForms_0200 - * @tc.name: The form user does not have permission. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_0200`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_0200 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0200 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("2"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0200")); - setTimeout(function () { - console.info('FMS_notifyVisibleForms_0200 onStateCallBack end'); - console.log(`FMS_notifyVisibleForms_0200 end`); - done(); - }, 1000) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbility again end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_0300 - * @tc.name: The length of the formId list is 0 (no formId) - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_0300`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_0300 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0300 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("7"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0300")); - - setTimeout(function () { - console.info('FMS_notifyVisibleForms_0300 delPublishCallBack end'); - console.log(`FMS_notifyVisibleForms_0300 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : [], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_0400 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_0400`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_0400 start`); - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0400 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0400")) - - setTimeout(function () { - console.info('FMS_notifyVisibleForms_0400 delPublishCallBack end'); - console.log(`FMS_notifyVisibleForms_0400 end`); - done(); - }, 100) - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["-1"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_0500 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_0500`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_0500 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0500 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0500")) - - setTimeout(function () { - console.info('FMS_notifyVisibleForms_0500 delPublishCallBack end'); - console.log(`FMS_notifyVisibleForms_0500 end`); - done(); - }, 100); - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["0"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_0600 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_0600`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_0600 start`); - let formId; - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0600 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0600")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_0600", done)); - } - async function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0600 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyVisibleForms_0600")) - formId = data.data; - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : [formId], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_0700 - * @tc.name: Form ID error (FormID does not exist) - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_0700`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_0700 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_0700 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0700")); - - setTimeout(function () { - console.info('FMS_notifyVisibleForms_0700 onStateCallBack end'); - console.log(`FMS_notifyVisibleForms_0700 end`); - done(); - }, 100); - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["123456789"], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbility again end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_1000 - * @tc.name: The form provider is the system application and config When form visiblenotify is true, - * the form provider can be notified that the form is visible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1000`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1000 start`); - let formIdInvisible; - let formIdVisible; - let onSupplyCount = 0; - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyVisibleForms_1000 onSupplyCallBack====>" + JSON.stringify(data)); - onSupplyCount++; - if (onSupplyCount == 2) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1000")); - } - if (formIdInvisible && formIdVisible) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_1000", done)); - } - } - } - - function onVisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1000 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - formIdVisible = data.parameters.formId; - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1000")); - if (formIdInvisible && formIdVisible && onSupplyCount == 2) { - let commonEventPublishData = { - data: formIdInvisible - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_1000", done)); - } - } - async function OnInvisibleCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1000 OnInvisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1000")) - formIdInvisible = data.parameters.formId; - - subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility again start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : [formIdInvisible], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility again end`); - } - - commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "invisible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_1100 - * @tc.name: Use 0 and created form card Id notify the form to be visible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1100`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1100 start`); - let assertFormId; - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1100")); - console.debug("====>FMS_notifyVisibleForms_1100 onSupplyCallBack====>" + JSON.stringify(data)); - let formId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[formId]; - expect(formId).assertEqual(assertFormId); - expect(visibilityStatus).assertEqual(1); - - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_1000", done)); - } - } - - function onVisibleCallBack(_, data) { - if (data.parameters.kind != "visible") { - return; - } - console.info("!!!====>FMS_notifyVisibleForms_1100 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - assertFormId = data.parameters.formId; - - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1100")); - } - - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["self", "0"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_notifyVisibleForms_1200 - * @tc.name: When the form provider is not a system application, notify the form to be visible - * and do not pull up the form provider. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1200`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1200 start`); - - function onVisibleCallBack(_, data) { - if (data.parameters.kind != "visible") { - return; - } - console.info("!!!====>FMS_notifyVisibleForms_1200 onVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - - setTimeout(function () { - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1200")); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1200")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_1200", done)); - }, 2000); - } - function onSupplyEventCallBack(_, data) { - if (data.parameters.kind != "onVisibilityChange") { - return; - } - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1200")); - console.debug("====>FMS_notifyVisibleForms_1200 onSupplyEventCallBack====>" + JSON.stringify(data)); - console.log(`FMS_notifyVisibleForms_1200 error`); - expect().assertFail(); - } - - commonEvent.subscribe(subscriberOnState, onVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); - console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicenotsysapp.hmservice", - "ability" : "com.form.formsystemtestservicenotsysapp.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_notifyVisibleForms_1300 - * @tc.name: Provider onVisibleChange can not be called when formVisibleNotify is false. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the onVisibleChange interface. - */ - it(`FMS_notifyVisibleForms_1300`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1300 start`); - - function OnVisibleCallBack(_, data) { - if (data.parameters.kind != "visible") { - return; - } - console.info("!!!====>FMS_notifyVisibleForms_1300 OnVisibleCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1300")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_1300", done)); - } - - commonEvent.subscribe(subscriberOnState, OnVisibleCallBack); - console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviced.hmservice", - "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : ["self"], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_notifyVisibleForms_1400 - * @tc.name: formVisibleNotify in config.json is true, - * it can notify the form provider that the form is not visible. - * @tc.desc: 1. The card is created successfully. - * 2. The visibility interface is successfully invoked. - * The visibility notification of form provider A is triggered, - * and the formId is the same as that of the created formId. - */ - it(`FMS_notifyVisibleForms_1400`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1400 start`); - let supplyFlag = false; - let formId1; - let formId2; - let delCount = 0; - let onSupplyCount = 0; - - function delPublishCallBack() { - console.info("!!!====>FMS_notifyVisibleForms_1400 delPublishCallBack====>"); - delCount++; - if (delCount == 2) { - setTimeout(function () { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1400")); - if (supplyFlag) { - expect().assertFail(); - } - console.info('FMS_notifyVisibleForms_1400 delPublishCallBack end'); - console.info('FMS_notifyVisibleForms_1400 end'); - done(); - }, 1000); - } - } - function onAcquiredCallBack_Normal1(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1400 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) - formId1 = data.data; - - FMS_notifyVisibleForms_1400_normal2(); - } - function unSubscribeOnAcquiredCallBack_Normal1() { - console.debug("====>FMS_notifyVisibleForms_1400 unSubscribeOnAcquiredCallBack_Normal2====>"); - } - async function FMS_notifyVisibleForms_1400_normal1() { - console.log(`FMS_notifyVisibleForms_1400_normal1 start`); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); - console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbility end`); - console.log(`FMS_notifyVisibleForms_1400_normal1 end`); - } - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1400")) - console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack formId1:====>" + formId1); - console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack formId2:====>" + formId2); - console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack onSupplyCount:====>" + onSupplyCount); - if (formId1 && formId2 && onSupplyCount == 1) { - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - let commonEventPublishData2 = { - data: formId2 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); - } - } - - async function onAcquiredCallBack_Normal2(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1400 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2); - formId2 = data.data; - - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - - console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : [formId1,formId2], - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbility end`); - } - function unSubscribeOnAcquiredCallBack_Normal2() { - console.debug("====>FMS_notifyVisibleForms_1400 unSubscribeOnAcquiredCallBack_Normal2====>"); - } - async function FMS_notifyVisibleForms_1400_normal2() { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); - console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviced.hmservice", - "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - - console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbility end`); - } - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyVisibleForms_1400 onSupplyCallBack====>" + JSON.stringify(data)); - let parameters = JSON.parse(data.parameters.parameters); - if(parameters[formId1]) { - expect(parameters[formId1]).assertEqual(1); - } - if(parameters[formId2]) { - expect(parameters[formId2]).assertEqual(1); - } - - onSupplyCount++; - if (onSupplyCount == 2) { - supplyFlag = true; - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1400")); - } - - if (formId1 && formId2) { - let commonEventPublishData = { - data: formId1 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); - let commonEventPublishData2 = { - data: formId2 - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); - } - } - } - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - FMS_notifyVisibleForms_1400_normal1(); - }); - /** - * @tc.number: FMS_notifyVisibleForms_1500 - * @tc.name: Created provider A and B form card, notify the form to be visible 3times. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1500`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1500 start`); - let formIds = new Array(); - let count = 0; - - function delPublishCallBack1(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1500 delPublishCallBack1====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_notifyVisibleForms_1500 delPublishCallBack1 end'); - console.log(`FMS_notifyVisibleForms_1500 end`); - }, 1000); - } - function delPublishCallBack2(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1500 delPublishCallBack2====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_notifyVisibleForms_1500 delPublishCallBack2 end'); - console.log(`FMS_notifyVisibleForms_1500 end`); - done(); - }, 1000); - } - - function onInVisibleSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyVisibleForms_1500 onInVisibleSupplyCallBack====>" + JSON.stringify(data)); - - let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; - expect(formIds.includes(retFormId)).assertTrue(); - expect(visibilityStatus).assertEqual(2); - - ++count; - if (count == 12) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); - let commonEventPublishData1 = { - data: formIds[0] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); - let commonEventPublishData2 = { - data: formIds[1] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); - } - } - } - - async function onVisibleSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyVisibleForms_1500 onVisibleSupplyCallBack====>" + JSON.stringify(data)); - - let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; - expect(formIds.includes(retFormId)).assertTrue(); - expect(visibilityStatus).assertEqual(1); - - ++count; - if (count == 6) { - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); - subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); - commonEvent.subscribe(subscriberSupply, onInVisibleSupplyCallBack); - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyInvisible start`); - for (var i = 0; i < 3; i++) { - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "stateForm": "invisible", - "stateIds": formIds, - "isCreate": false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - } - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyInvisible end`); - } - } - } - - async function onAcquiredCallBack2(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); - console.debug("====>FMS_notifyVisibleForms_1500 onAcquiredCallBack2====>" + JSON.stringify(data)); - formIds.push(data.data); - console.debug("====>FMS_notifyVisibleForms_1500 formIds====>" + formIds); - - commonEvent.subscribe(subscriberSupply, onVisibleSupplyCallBack); - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyVisible start`); - for (var i = 0; i < 3; i++) { - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "stateForm": "visible", - "stateIds": formIds, - "isCreate": false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - } - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyVisible end`); - } - - async function onAcquiredCallBack1(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); - console.debug("====>FMS_notifyVisibleForms_1500 onAcquiredCallBack1====>" + JSON.stringify(data)); - formIds.push(data.data); - console.debug("====>FMS_notifyVisibleForms_1500 formIds====>" + JSON.stringify(formIds)); - - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack2); - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility serviceb start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviceb.hmservice", - "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility serviceb end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack1); - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility servicea end`); - }); - - /** - * @tc.number: FMS_notifyVisibleForms_1600 - * @tc.name: Use -1 and created form card Id notify the form to be visible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1600`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1600 start`); - let formIds = new Array(); - let count = 0; - - function delPublishCallBack1(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1600 delPublishCallBack1====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_notifyVisibleForms_1600 delPublishCallBack1 end'); - console.log(`FMS_notifyVisibleForms_1600 end`); - }, 1000); - } - function delPublishCallBack2(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1600 delPublishCallBack2====>" + JSON.stringify(data)); - setTimeout(function () { - console.info('FMS_notifyVisibleForms_1600 delPublishCallBack2 end'); - console.log(`FMS_notifyVisibleForms_1600 end`); - done(); - }, 1000); - } - - function onSupplyCallBack(_, data) { - if (data.parameters.kind == "onVisibilityChange") { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - console.debug("====>FMS_notifyVisibleForms_1600 onSupplyCallBack====>" + JSON.stringify(data)); - - let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; - expect(formIds.includes(retFormId)).assertTrue(); - expect(visibilityStatus).assertEqual(1); - - ++count; - if (count == 2) { - console.debug("====>FMS_notifyVisibleForms_1600 OK====>"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); - - let commonEventPublishData1 = { - data: formIds[0] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); - let commonEventPublishData2 = { - data: formIds[1] - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); - } - } - } - - async function onSecondAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyVisibleForms_1500")); - console.debug("====>FMS_notifyVisibleForms_1600 onSecondAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - formIds.push("-1"); - console.debug("====>FMS_notifyVisibleForms_1600 formIds====>" + formIds); - - commonEvent.subscribe(subscriberSupply, onSupplyCallBack); - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility notifyVisible start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "name", - "bundle" : "bundle", - "ability" : "ability", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : formIds, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility notifyVisible end`); - } - - async function onFirstAcquiredCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyVisibleForms_1500")); - console.debug("====>FMS_notifyVisibleForms_1600 onFirstAcquiredCallBack====>" + JSON.stringify(data)); - formIds.push(data.data); - - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - commonEvent.subscribe(subscriberOnAcquired, onSecondAcquiredCallBack); - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility serviceb start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestserviceb.hmservice", - "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility serviceb end`); - } - - commonEvent.subscribe(subscriberOnAcquired, onFirstAcquiredCallBack); - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility servicea end`); - }); - - /** - * @tc.number: FMS_notifyVisibleForms_1700 - * @tc.name: Use -1 and created form card Id notify the form to be visible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1700`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1700 start`); - - function onFormVisibleCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1700")); - console.debug("====>FMS_notifyVisibleForms_1700 onFirstAcquiredCallBack====>" + JSON.stringify(data)); - expect(data.parameters.kind).assertEqual("visible"); - expect(data.data).assertEqual("0"); - - setTimeout(function () { - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback("FMS_notifyVisibleForms_1700", done)); - }, 2000); - } - - function onFormSupplyCallBack(_, data) { - expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); - commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1700")); - console.debug("====>FMS_notifyVisibleForms_1700 onFormSupplyCallBack====>" + JSON.stringify(data)); - if (data.parameters.kind == "onVisibilityChange") { - console.debug("====>FMS_notifyVisibleForms_1700 error"); - expect().assertFail(); - } - } - - commonEvent.subscribe(subscriberOnState, onFormVisibleCallBack); - commonEvent.subscribe(subscriberSupply, onFormSupplyCallBack); - console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbility servicea start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true, - "isStartOtherApp" : true, - "otherAppState" : "visible" - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbility servicea end`); - }); - - /** - * @tc.number: FMS_notifyVisibleForms_1800 - * @tc.name: When formVisibleNotify is true in config.json, - * the form provider will be pulled when the card is visible. - * @tc.desc: 1.The form user calls the visible notification interface. - * 2.Verify the result of the visible notification interface. - */ - it(`FMS_notifyVisibleForms_1800`, 0, async (done) => { - console.info(`FMS_notifyVisibleForms_1800 start`); - let hostFormId; - let providerFormId; - let counter = 0; - - const delPublishCallback = (_, data) => { - console.info("!!!====>FMS_notifyVisibleForms_1800 delPublishCallback====>"); - setTimeout(() => { - expect(hostFormId).assertEqual(providerFormId); - console.info('FMS_notifyVisibleForms_1800 delPublishCallback end'); - console.info(`FMS_notifyVisibleForms_1800 end`); - done(); - }, 1000); - } - - const onSupplyCallback = (_, data) => { - if (data.parameters.kind != "onVisibilityChange") { - return; - } - console.debug("====>FMS_notifyVisibleForms_1800 onSupplyCallback data:====>" + JSON.stringify(data)); - providerFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; - const visibilityStatus = JSON.parse(data.parameters.parameters)[providerFormId]; - - expect(visibilityStatus).assertEqual(1); - commonEvent.unsubscribe(subscriberSupply, () => { - console.info("====>FMS_notifyVisibleForms_1800 unSubscribeSupplyCallback====>"); - }); - if (++counter == 2) { - const commonEventPublishData = { - data: providerFormId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - } - } - - const onVisibleCallback = (_, data) => { - if (data.parameters.kind != "visible") { - return; - } - console.debug("====>FMS_notifyVisibleForms_1800 onVisibleCallback data:====>" + JSON.stringify(data)); - hostFormId = data.parameters.formId; - - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnState, () => { - console.info("====>FMS_notifyVisibleForms_1800 unSubscribeOnVisibleCallback====>"); - }); - if (++counter == 2) { - const commonEventPublishData = { - data: hostFormId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); - } - } - - commonEvent.subscribe(subscriberOnState, onVisibleCallback); - commonEvent.subscribe(subscriberSupply, onSupplyCallback); - console.info(`FMS_notifyVisibleForms_1800 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId": "0", - "name": "Form_Js001", - "bundle": "com.form.formsystemtestservicef.hmservice", - "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", - "moduleName": "entry", - "temporary": false, - "stateForm": "visible", - "stateIds": ["self"], - "isCreate": true - } - } - }).then((res: any) => { - console.debug(`FMS_notifyVisibleForms_1800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.debug(`FMS_notifyVisibleForms_1800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - }); - /** - * @tc.number: FMS_notifyVisibleForms_1900 - * @tc.name: The size of visible form ids in the notification form array exceeds 32. - * @tc.desc: 1. Failed to invoke the visibility interface (parameter error). - */ - it(`FMS_notifyVisibleForms_1900`, 0, async (done) => { - console.log(`FMS_notifyVisibleForms_1900 start`); - - function onStateCallBack(_, data) { - console.info("!!!====>FMS_notifyVisibleForms_1900 onStateCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1900")) - - setTimeout(function () { - console.info('FMS_notifyVisibleForms_1900 delPublishCallBack end'); - console.log(`FMS_notifyVisibleForms_1900 end`); - done(); - }, 100); - } - - commonEvent.subscribe(subscriberOnState, onStateCallBack); - console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostg", - abilityName: "com.ohos.st.formsystemhostg.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", - "moduleName" : "entry", - "temporary" : false, - "stateForm" : "visible", - "stateIds" : [ - "1","2","3","4","5","6","7","8","9","10","11","12","13","14", - "15","16","17","18","19","20","21","22","23","24","25","26", - "27","28","29","30","31","32","33" - ], - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbility end`); - }); - }); -} - -const sleep = async delay => { - return new Promise((resolve, _) => { - setTimeout(async () => { - resolve(0); - }, delay); - }); -}; - -const delPublishCallback = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000); -} - -const unsubscribeOnStateCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); -} - -const unsubscribeSupplyCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index b460da51fb9f2a3aae604d8f4daf384e8ac1b379..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsFormStateNotifyVisible.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 708abba6f8b1c683196824cb151e76550121524c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formvisiblestatetest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/BUILD.gn deleted file mode 100644 index 5a46df2ed17b4ebd2f22fffbd1b8ef4035cd354d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormStressTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormStressTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/Test.json deleted file mode 100644 index eef9043aed716049a5556dd5c430ad65eb5c2628..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/Test.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "360000", - "package": "com.ohos.st.formstresstest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormStressTest.hap", - "FormSystemHostK.hap", - "FormSupplyAppF.hap", - "FormSupplyAppG.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json deleted file mode 100644 index 60041de484f4e6a154900627337a9d99f7bde5cf..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.st.formstresstest", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.st.formstresstest", - "name": ".FormStressSTApp", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "defPermissions": [ - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnDeleted_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnAcquired_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnError_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormCast_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormSupply_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "availableScope": [], - "grantMode": "system_grant", - "name": "FMS_FormDelete_commonEvent" - } - ], - "reqPermissions": [ - { - "name": "FMS_FormOnAcquired_commonEvent", - "reason": "need use onAcquired commonEvent" - }, - { - "name": "FMS_FormOnDeleted_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "FMS_FormOnError_commonEvent", - "reason": "need use OnError commonEvent" - }, - { - "name": "FMS_FormCast_commonEvent", - "reason": "need use castFrom commonEvent" - }, - { - "name": "FMS_FormSupply_commonEvent", - "reason": "need use FormSupply commonEvent" - }, - { - "name": "FMS_FormOnReleased_commonEvent" - }, - { - "name": "FMS_FormOnRequest_commonEvent" - }, - { - "name": "FMS_FormDelete_commonEvent", - "reason": "need use delete commonEvent" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES", - "reason": "need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name": "ohos.permission.CLEAN_APPLICATION_DATA" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 83dd3d4f89d10e36cf17e9a1f7dba026f14c088b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('[FormComponent] Application onCreate') - }, - onDestroy() { - console.info('[FormComponent] Application onDestroy') - }, -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 252e4179870ef333a254f88ba8824827d0e522d7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,68 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - want.parameters['timeout'] = 10000; - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Stress Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets deleted file mode 100644 index 8a34f7ae00f645c76b81fd3ea86c44e1659e2ef9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets +++ /dev/null @@ -1,670 +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 featureAbility from '@ohos.ability.featureAbility'; -import formHost from '@ohos.application.formHost'; -import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index.ets'; - -const onDeletedEvent = { - events: [`FMS_FormOnDeleted_commonEvent`] -} -const onAcquiredEvent = { - events: [`FMS_FormOnAcquired_commonEvent`] -}; -const onSupplyEvent = { - events: [`FMS_FormSupply_commonEvent`] -}; -const formOnDeleteEvent = `FMS_FormDelete_commonEvent`; - -const unsubscribeOnDeletedCallback = (tcNumber, done) => { - console.info(`${tcNumber} unsubscribeOnDeleted Callback`); - done(); -} -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.info(`${tcNumber} unsubscribeOnAcquired Callback`); -} -const unsubscribeOnSupplyCallback = (tcNumber) => { - console.info(`${tcNumber} unsubscribeOnSupply Callback`); -} -const publishOnDeleteCallback = (tcNumber) => { - console.info(`${tcNumber} publishOnDelete Callback`); -} - -let onDeletedEventSubscriber; -let onAcquiredEventSubscriber; -let onSupplyEventSubscriber; - -export default function test() { - describe(`FmsStressTest`, () => { - - beforeEach(async () => { - onDeletedEventSubscriber = await commonEvent.createSubscriber(onDeletedEvent); - onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent); - onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); - }); - - const subscribeDeletedEvent = (tcNumber, expectedDeletedFormAmount, done) => { - commonEvent.subscribe(onDeletedEventSubscriber, async (err, data) => { - const formIds = data.parameters.formIds; - const deletedFormAmount = data.parameters.deletedFormAmount; - console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onDeletedCallback formIds: ${formIds}`); - - expect(expectedDeletedFormAmount).assertEqual(deletedFormAmount); - expect(err.code).assertEqual(0); - console.info(`${tcNumber} onDeletedCallback end`); - commonEvent.unsubscribe(onDeletedEventSubscriber, () => unsubscribeOnDeletedCallback(tcNumber, done)); - }); - } - - /** - * @tc.number: FMS_stressTest_0100 - * @tc.name: Create form test. - * @tc.desc: OnCreate form interface working well. - */ - it(`FMS_stressTest_0100`, 0, async (done) => { - const tcNumber = `FMS_stressTest_0100`; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const formId = data.data; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - expect(err.code).assertEqual(0); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(formId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onAcquiredCallback end`); - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_0200 - * @tc.name: Host release form test. - * @tc.desc: releaseForm method working well. - */ - it(`FMS_stressTest_0200`, 0, async (done) => { - const tcNumber = `FMS_stressTest_0200`; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - expect(err.code).assertEqual(0); - if (`release` == kind) { - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - } else { - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(formId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onAcquiredCallback end`); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - releaseForm: true, - isCreate: true, - temporary: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_0300 - * @tc.name: Host cast temp form test. - * @tc.desc: castTempForm method working well. - */ - it(`FMS_stressTest_0300`, 0, async (done) => { - const tcNumber = `FMS_stressTest_0300`; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - expect(err.code).assertEqual(0); - if (`castTempForm` == kind) { - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: formId, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry` - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(formId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onAcquiredCallback end`); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - castTempForm: true, - isCreate: true, - temporary: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_0500 - * @tc.name: Provider set form next refresh time test. - * @tc.desc: setFormNextRefreshTime method working well. - */ - it(`FMS_stressTest_0500`, 0, async (done) => { - const tcNumber = `FMS_stressTest_0500`; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onSetFormNextRefreshTime` == kind) { - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(supplyFormId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onSupplyCallback end`); - } - }); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - if (`notifyVisibleForms` == kind) { - expect(err.code).assertEqual(0); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback end`); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - notifyVisibleForms: true, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_0700 - * @tc.name: Host request form test. - * @tc.desc: requestForm method working well. - */ - it(`FMS_stressTest_0700`, 0, async (done) => { - const tcNumber = `FMS_stressTest_0700`; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - if (`request` == kind) { - expect(err.code).assertEqual(0); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(formId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onAcquiredCallback end`); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - requestForm: true, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_0900 - * @tc.name: Provider update form test. - * @tc.desc: updateForm method working well. - */ - it(`FMS_stressTest_0900`, 0, async (done) => { - const tcNumber = `FMS_stressTest_0900`; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onUpdateForm` == kind) { - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(supplyFormId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onSupplyCallback end`); - } - }); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - if (`notifyVisibleForms` == kind) { - expect(err.code).assertEqual(0); - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback end`); - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - notifyVisibleForms: true, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_1100 - * @tc.name: Host notify form's visibility test. - * @tc.desc: notifyVisibleForms and notifyInvisibleForms method working well. - */ - it(`FMS_stressTest_1100`, 0, async (done) => { - const tcNumber = `FMS_stressTest_1100`; - let hostCounter = 0; - let providerCounter = 0; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { - console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - const kind = data.parameters.kind; - const supplyFormId = `onCreate` == kind - ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] - : `onVisibilityChange` == kind - ? Object.keys(JSON.parse(data.parameters.parameters))[0] - : data.parameters.parameters; - console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); - - if (`onVisibilityChange` == kind) { - if (++providerCounter == 2) { - commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(supplyFormId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onSupplyCallback end`); - } - } - }); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - if (`notifyVisibleForms` == kind) { - expect(err.code).assertEqual(0); - if (++hostCounter == 2) { - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback end`); - } - } else if (`notifyInvisibleForms` == kind) { - expect(err.code).assertEqual(0); - if (++hostCounter == 2) { - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - console.info(`${tcNumber} onAcquiredCallback end`); - } - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestserviceg.hmservice`, - ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, - moduleName: `entry`, - notifyVisibility: true, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_1300 - * @tc.name: Forms update test. - * @tc.desc: enableFormsUpdate and disableFormsUpdate method working well. - */ - it(`FMS_stressTest_1300`, 0, async (done) => { - const tcNumber = `FMS_stressTest_1300`; - let hostCounter = 0; - - subscribeDeletedEvent(tcNumber, 1, done); - - commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { - const kind = data.parameters.kind; - const formId = data.parameters.formId; - console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); - console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); - - if (`enableUpdate` == kind) { - expect(err.code).assertEqual(0); - if (++hostCounter == 2) { - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(formId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onAcquiredCallback end`); - } - } else if (`disableUpdate` == kind) { - expect(err.code).assertEqual(0); - if (++hostCounter == 2) { - commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); - setTimeout(() => { - commonEvent.publish(formOnDeleteEvent, { - parameters: { - formIds: [].concat(formId) - } - }, () => publishOnDeleteCallback(tcNumber)); - }, 500); - console.info(`${tcNumber} onAcquiredCallback end`); - } - } - }); - - try { - const res = await featureAbility.startAbility({ - want: { - bundleName: `com.ohos.st.formsystemhostk`, - abilityName: `com.ohos.st.formsystemhostk.MainAbility`, - parameters: { - formId: `0`, - name: `Form_Js001`, - bundle: `com.form.formsystemtestservicef.hmservice`, - ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, - moduleName: `entry`, - update: true, - isCreate: true - } - } - }); - console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); - } catch (error) { - console.info(`${tcNumber} error: ${JSON.stringify(error)}`); - console.info(`${tcNumber} should not reach here`); - expect().assertFail(); - } - }); - - /** - * @tc.number: FMS_stressTest_1700 - * @tc.name: Get forms info test. - * @tc.desc: getAllFormsInfo and getFormsInfo method working well. - */ - it(`FMS_stressTest_1700`, 0, async (done) => { - const tcNumber = `FMS_stressTest_1700`; - - let allFormsInfo = await formHost.getAllFormsInfo(); - const providerBundleNameList = [ - `com.form.formsystemtestservicef.hmservice`, - `com.form.formsystemtestserviceg.hmservice` - ]; - - console.info(`${tcNumber} getAllFormsInfo: ${JSON.stringify(allFormsInfo)}`); - console.info(`${tcNumber} before filter size: ${JSON.stringify(allFormsInfo.length)}`); - allFormsInfo = allFormsInfo.filter((formsInfo) => providerBundleNameList.includes(formsInfo.bundleName)); - console.info(`${tcNumber} after filter size: ${JSON.stringify(allFormsInfo.length)}`); - expect(allFormsInfo.length).assertEqual(2); - - allFormsInfo.forEach(async (formsInfo, index) => { - const providerFormsInfo1 = await formHost.getFormsInfo(formsInfo.bundleName); - const providerFormsInfo2 = await formHost.getFormsInfo(formsInfo.bundleName, formsInfo.moduleName); - - console.info(`${tcNumber} getFormsInfo: ${JSON.stringify(providerFormsInfo1)}`); - console.info(`${tcNumber} getFormsInfo: ${JSON.stringify(providerFormsInfo2)}`); - expect(providerFormsInfo1.bundleName).assertEqual(providerFormsInfo2.bundleName); - - if (index == allFormsInfo.length - 1) { - done(); - } - }); - }); - - /** - * @tc.number: FMS_stressTest_1800 - * @tc.name: Form system ready test. - * @tc.desc: isSystemReady method working well. - */ - it(`FMS_stressTest_1800`, 0, async (done) => { - const tcNumber = `FMS_stressTest_1800`; - - const systemstatus = await formHost.isSystemReady(); - console.info(`${tcNumber} systemstatus: ${JSON.stringify(systemstatus)}`); - expect(systemstatus).assertEqual(0); - done(); - }); - }); -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 8d8417a94f689ec75080a817d27edf7ce6733ce9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,19 +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 from './FmsStress.test.ets'; - -export default function testsuite() { - test(); -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 9346b4a60f0b4d6eb2a937666d779c688dc26600..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "formsttest" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/BUILD.gn b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/BUILD.gn deleted file mode 100644 index 43d4c966fff00d8d56c29c1bd13f60ff37d41a4b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/BUILD.gn +++ /dev/null @@ -1,32 +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("FormUpdateRefreshTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "FormUpdateRefreshTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/Test.json b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/Test.json deleted file mode 100644 index 0a6bca82e71e3c00f201beeedb553aaa75017bcf..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/Test.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.ohos.st.formupdaterefreshtest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FormUpdateRefreshTest.hap", - "FormSystemHostE.hap", - "FormSystemHostF.hap", - "FormSystemHostNoPerm.hap", - "FormSupplyAppA.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 04791d0a0e3385731a98c4fa358e255582f6f587..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,67 +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. - */ - -// @ts-nocheck -import featureAbility from "@ohos.ability.featureAbility"; -import file from '@system.file'; -import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; - -@Entry -@Component -struct Index { - - aboutToAppear() { - - console.info("[FormComponent] start run testcase!!!!"); - - featureAbility.getWant() - .then((want: any) => { - console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); - configService.setConfig(want.parameters); - testsuite(); - core.execute(); - }) - .catch((error: any) => { - console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Fms Main Ability Test') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets b/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets deleted file mode 100644 index 7920c84b59fbb99a8e26904d35d93574ca735e5f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets +++ /dev/null @@ -1,707 +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 featureAbility from "@ohos.ability.featureAbility"; -import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index.ets"; - -var onAcquiredForm_Event = { - events: ["FMS_FormOnAcquired_commonEvent"], -}; -var onDeletedFormEvent = { - events: ["FMS_FormOnDeleted_commonEvent"], -}; -var onUpdateRefreshEvent = { - events: ["FMS_FormUpdateRefresh_commonEvent"], -}; -var onRequestFormEvent = { - events: ["FMS_FormOnRequest_commonEvent"], -}; - -var deleteForm_Event = "FMS_FormDelete_commonEvent"; - - -var subscriberOnAcquired; -var subscriberOnDeleted; -var subscriberOnRefresh; -var subscriberOnRequest; - -export default function test() { - describe(`FmsUpdateRefreshFormTest`, () => { - - beforeAll(async (done) => { - done(); - }) - - beforeEach(async () => { - subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); - subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); - subscriberOnRefresh = await commonEvent.createSubscriber(onUpdateRefreshEvent); - subscriberOnRequest = await commonEvent.createSubscriber(onRequestFormEvent); - }) - - /** - * @tc.number: FMS_updateForm_0100 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_updateForm_0100`, 0, async (done) => { - console.log(`FMS_updateForm_0100 start`); - - function onRefreshCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0100 onRefreshCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0100")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_updateForm_0100", done)); - } - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); - console.log(`FMS_updateForm_0100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "updateForm" : true, - "updateId" : "-1", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0100 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_updateForm_0200 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_updateForm_0200`, 0, async (done) => { - console.log(`FMS_updateForm_0200 start`); - - function onRefreshCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0200 onRefreshCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0200")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_updateForm_0200", done)); - } - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); - console.log(`FMS_updateForm_0200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "updateForm" : true, - "updateId" : "0", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0200 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_updateForm_0300 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form provider B to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_updateForm_0300`, 0, async (done) => { - console.log(`FMS_updateForm_0300 start`); - let formId; - - function onRefreshCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0300 onRefreshCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0300")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_updateForm_0300", done)); - } - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0300 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_updateForm_0300")); - formId = data.data; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); - - console.log(`FMS_updateForm_0300 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "updateForm" : true, - "updateId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0300 featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_updateForm_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_updateForm_0400 - * @tc.name: Form ID error (FormID does not exist) - * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_updateForm_0400`, 0, async (done) => { - console.log(`FMS_updateForm_0400 start`); - let formId; - - function onRefreshCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0400 onRefreshCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0400")); - setTimeout(function () { - console.info('FMS_updateForm_0400 onRefreshCallBack end'); - console.log(`FMS_updateForm_0400 end`); - done(); - }, 1000); - } - function onDeletedCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0400 onDeletedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnDeleted_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeDeletedCallback("FMS_updateForm_0400")); - formId = data.parameters.formId; - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); - - console.log(`FMS_updateForm_0400 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "updateForm" : true, - "updateId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0400 featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallBack); - console.log(`FMS_updateForm_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "deleteForm" : true, - "deleteId" : "self", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_updateForm_0500 - * @tc.name: The jsonData of form in the provider is empty. - * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. - */ - it(`FMS_updateForm_0500`, 0, async (done) => { - console.log(`FMS_updateForm_0500 start`); - - function onRefreshCallBack(_, data) { - console.info("!!!====>FMS_updateForm_0500 onRefreshCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0500")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_updateForm_0500", done)); - } - commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); - console.log(`FMS_updateForm_0500 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "updateForm" : true, - "updateId" : "self", - "jsonEmpty" : true, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_updateForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_updateForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_updateForm_0500 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_hostRefresh_0100 - * @tc.name: formID id is error(formID < 0) - * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_hostRefresh_0100`, 0, async (done) => { - console.log(`FMS_hostRefresh_0100 start`); - - function onRequestCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0100 onRequestCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0100")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_hostRefresh_0100", done)); - } - commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); - console.log(`FMS_hostRefresh_0100 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "requestForm" : true, - "requestId" : "-1", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0100 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_hostRefresh_0200 - * @tc.name: formID id is error(formID == 0) - * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_hostRefresh_0200`, 0, async (done) => { - console.log(`FMS_hostRefresh_0200 start`); - - function onRequestCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0200 onRequestCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0200")); - - let commonEventPublishData = { - data: data.parameters.formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_hostRefresh_0200", done)); - } - commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); - console.log(`FMS_hostRefresh_0200 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "requestForm" : true, - "requestId" : "0", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0200 featureAbility.startAbility end`); - }); - - /** - * @tc.number: FMS_hostRefresh_0300 - * @tc.name: formID id is error because formId is not self - * @tc.desc: 1.The form user B to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_hostRefresh_0300`, 0, async (done) => { - console.log(`FMS_hostRefresh_0300 start`); - let formId; - - function onRequestCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0300 onRequestCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRefreshCallback("FMS_hostRefresh_0300")); - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_hostRefresh_0300", done)); - } - - function onAcquiredCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0300 onAcquiredCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); - commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_hostRefresh_0300")); - formId = data.data; - commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); - - console.log(`FMS_hostRefresh_0300 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "requestForm" : true, - "requestId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0300 featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); - console.log(`FMS_hostRefresh_0300 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0300 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_hostRefresh_0400 - * @tc.name: Form ID error (FormID does not exist) - * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_hostRefresh_0400`, 0, async (done) => { - console.log(`FMS_hostRefresh_0400 start`); - let formId; - - function onRequestCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0400 onRequestCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0400")); - setTimeout(function () { - console.info('FMS_hostRefresh_0400 onRequestCallBack end'); - console.log(`FMS_hostRefresh_0400 end`); - done(); - }, 10); - } - function onDeletedCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0400 onDeletedCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnDeleted_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeDeletedCallback("FMS_hostRefresh_0400")); - formId = data.parameters.formId; - commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); - - console.log(`FMS_hostRefresh_0400 featureAbility.startAbility again start`); - featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "requestForm" : true, - "requestId" : formId, - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0400 featureAbility.startAbility again end`); - } - commonEvent.subscribe(subscriberOnDeleted, onDeletedCallBack); - console.log(`FMS_hostRefresh_0400 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostf", - abilityName: "com.ohos.st.formsystemhostf.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "deleteForm" : true, - "deleteId" : "self", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0400 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_hostRefresh_0600 - * @tc.name: The form user has no form permission. - * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. - * 2.Verify the result of the intiative timed refresh interface. - */ - it(`FMS_hostRefresh_0600`, 0, async (done) => { - console.log(`FMS_hostRefresh_0600 start`); - - function onRequestCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0600 onRequestCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); - expect(data.data != "0").assertEqual(true); - commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0600")); - - setTimeout(function () { - console.info('FMS_hostRefresh_0600 onRequestCallBack end'); - console.log(`FMS_hostRefresh_0600 end`); - done(); - }, 1000) - } - - commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); - console.log(`FMS_hostRefresh_0600 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhostnoperm", - abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "requestForm" : true, - "requestId" : "1", - "isCreate" : false - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0600 featureAbility.startAbility end`); - }); - /** - * @tc.number: FMS_hostRefresh_0700 - * @tc.name: Refresh form successfully by the form user. - * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. - * 2.Verify that pulling up the form provider. - */ - it(`FMS_hostRefresh_0700`, 0, async (done) => { - console.log(`FMS_hostRefresh_0700 start`); - let formId; - - function onRequestCallBack(_, data) { - console.info("!!!====>FMS_hostRefresh_0700 onRequestCallBack data:====>" + JSON.stringify(data)); - expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); - expect(data.data).assertEqual("0"); - commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0700")); - formId = data.parameters.formId; - let commonEventPublishData = { - data: formId - }; - commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack("FMS_hostRefresh_0700", done)); - } - - commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); - - console.log(`FMS_hostRefresh_0700 featureAbility.startAbility start`); - await featureAbility.startAbility({ - want: { - bundleName: "com.ohos.st.formsystemhoste", - abilityName: "com.ohos.st.formsystemhoste.MainAbility", - parameters: { - "formId" : "0", - "name" : "Form_Js001", - "bundle" : "com.form.formsystemtestservicea.hmservice", - "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", - "moduleName" : "entry", - "temporary" : false, - "requestForm" : true, - "requestId" : "self", - "isCreate" : true - } - } - }).then((res: any) => { - console.log(`FMS_hostRefresh_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); - }).catch((err: any) => { - console.log(`FMS_hostRefresh_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - }); - console.log(`FMS_hostRefresh_0700 featureAbility.startAbility end`); - }); - }); -} - -const delPublishCallBack = async (tcNumber, done) => { - console.info(`${tcNumber} delPublishCallBack start`); - setTimeout(function () { - console.info(`${tcNumber} delPublishCallBack end`); - done(); - }, 1000) -} - -const unsubscribeOnRequestCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnRequestCallback CallBack====>`); -} - -const unsubscribeOnRefreshCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnRefreshCallback CallBack====>`); -} - -const unsubscribeDeletedCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeDeletedCallback====>`); -} - -const unsubscribeOnAcquiredCallback = (tcNumber) => { - console.debug(`====>${tcNumber} unsubscribeOnAcquiredCallback CallBack====>`); -} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/app.json b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/app.json deleted file mode 100755 index 401aac00598c6c67b5ddbbcdcd7022d8be6e4f9f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.acts.killprocesswithaccountpackage", - "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/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn deleted file mode 100755 index ee3d4bb15b5c621c33284b16330a95eaae9e777e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsKillProcessWithAccountRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actskillprocesswithaccountrelyhap_js_assets", - ":actskillprocesswithaccountrelyhap_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsKillProcessWithAccountRelyHap" -} - -ohos_app_scope("actskillprocesswithaccountrelyhap_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actskillprocesswithaccountrelyhap_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actskillprocesswithaccountrelyhap_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actskillprocesswithaccountrelyhap_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/Test.json b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 8a70e879c3db1c3ad36ef8efc171e158b83f7452..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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("MainAbilityT onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbilityT onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbilityT onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("MainAbilityT onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("MainAbilityT onForeground") - } - - onBackground() { - // Ability has back to background - console.log("MainAbilityT onBackground") - } -}; diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json deleted file mode 100755 index fb28a871510b5d914d7a378d143ca1b497160793..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "com.acts.killprocesswithaccountpackage", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.acts.killprocesswithaccountpackage.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/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/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/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/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index cdc6a3a98fefdc4f1aee7660fc23052a85ac7143..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,49 +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.ets" -import testsuite from "../../test/List.test.ets" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('停止进程') - .fontSize(60) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/app.js deleted file mode 100755 index 875191631733a62e2bdff76d6b5a2e2f1b130937..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/app.js +++ /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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js deleted file mode 100755 index 8075462004ab121244be198f0d7dfa290db53a4d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,85 +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 app from '@system.app' -import device from '@system.device' -import router from '@system.router' -import { Core, ExpectExtend } from 'deccjsunit/index' -import featureAbility from '@ohos.ability.featureability' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: "" - }, - onInit() { - console.info('ACTS_NewWant Api7 onInit'); - this.title = "ProcessManageSystemAppA"; - }, - onReady() { - console.info('ACTS_NewWant Api7 onReady'); - }, - onActive() { - console.info('ACTS_NewWant Api7 onActive'); - }, - async onShow() { - console.info('ACTS_NewWant Api7 onShow'); - - await featureAbility.startAbility( - { - want: - { - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.SecondAbility", - action: "restartSecondAbility0800", - }, - } - ); - - }, - onInactive() { - console.info('ACTS_NewWant Api7 onInactive'); - }, - onHide() { - console.info('ACTS_NewWant Api7 onHide'); - }, - onDestroy() { - console.info('ACTS_NewWant Api7 onDestroy'); - }, - onBackPress() { - console.info('ACTS_NewWant Api7 onBackPress'); - }, - onNewRequest() { - console.info('ACTS_NewWant Api7 onNewRequest'); - }, - onStartContinuation() { - console.info('ACTS_NewWant Api7 onStartContinuation'); - }, - onSaveData(value) { - console.info('ACTS_NewWant Api7 onSaveData:' + JSON.stringify(value)); - }, - onRestoreData(value) { - console.info('ACTS_NewWant Api7 onRestoreData:' + JSON.stringify(value)); - }, - onCompleteContinuation(code) { - console.info('ACTS_NewWant Api7 onCompleteContinuation:' + JSON.stringify(code)); - }, - onConfigurationUpdated(configuration) { - console.info('ACTS_NewWant Api7 onConfigurationUpdated:' + JSON.stringify(configuration)); - } -} - diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/element/string.json deleted file mode 100755 index d405647b90183b99fb4e15025a9fe12c85c495d4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts deleted file mode 100755 index 1cd97264ea3156854be6920c5354cc74f70c2411..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ /dev/null @@ -1,146 +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' -import commonEvent from '@ohos.commonEvent' - -export default class SecondAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("ACTS_NewWant SecondAbility onCreate") - globalThis.abilityWant = want; - commonEvent.publish("onCreateSecond_To_Test_CommonEvent", () => { - console.log("ACTS_NewWant Publish CallBack onCreateSecond_To_Test_CommonEvent") - }); - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_NewWant SecondAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_NewWant SecondAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - - commonEvent.publish("onWindowStageCreateSecond_To_Test_CommonEvent", () => { - console.log("ACTS_NewWant Publish CallBack onWindowStageCreateSecond_To_Test_CommonEvent") - }); - } - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_NewWant SecondAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - var connId; - console.log("ACTS_NewWant SecondAbility onForeground") - if (globalThis.abilityWant.action == 'startSingleton0400') - { - globalThis.abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.MainAbility", - action:"startStandard0400" - }, (error, data) => { - console.log('ACTS_NewWant SecondAbility onForeground - startAbility start standard: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - } - if (globalThis.abilityWant.action == 'startSingleton0300') - { - globalThis.abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.MainAbility", - action:"restartSingleton" - }, (error, data) => { - console.log('ACTS_NewWant SecondAbility onForeground - startAbility restart standard: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - } - if (globalThis.abilityWant.action == 'startHapA0500') { - globalThis.abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapb.MainAbility", - action: "restartHapB" - }, (error, data) => { - console.log('ACTS_NewWant SecondAbility onForeground - startAbility restart HapB: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - } - if (globalThis.abilityWant.action == 'startHapA0600') { - globalThis.abilityContext.startAbility({ - bundleName: "com.example.newwanthapa", - abilityName: "com.example.newwanthapc.MainAbility", - action: "restartHapC" - }, (error, data) => { - console.log('ACTS_NewWant SecondAbility onForeground - startAbility restart HapC: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - } - if (globalThis.abilityWant.action == 'startSecondAbility0700') { - globalThis.abilityContext.startAbility( - { - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.MainAbility", - action: "startMainAbility0700" - }, (error, data) => { - console.log('ACTS_NewWant SecondAbility onForeground - startAbility startMainAbility0700: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }); - } - if (globalThis.abilityWant.action == 'startSecondAbility0800') { - globalThis.abilityContext.startAbility( - { - bundleName: "com.example.newwanthapapi7", - abilityName: "com.example.newwanthapapi7.MainAbility", - action: "startapi70800" - }, (error, data) => { - console.log('ACTS_NewWant SecondAbility onForeground - startAbility startapi70800: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }); - } - commonEvent.publish("onForegroundSecond_To_Test_CommonEvent", () => { - console.log("ACTS_NewWant SecondAbility Publish CallBack onForegroundSecond_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("ACTS_NewWant SecondAbility onBackground") - } - - onNewWant(want) { - // Ability has brought to foreground when it already in foreground - console.log("ACTS_NewWant SecondAbility onNewWant") - globalThis.abilityWant = want; - console.log("ACTS_NewWant SecondAbility onNewWant deviceId :" + want.deviceId) - console.log("ACTS_NewWant SecondAbility onNewWant bundleName :" + want.bundleName) - console.log("ACTS_NewWant SecondAbility onNewWant abilityName :" + want.abilityName) - console.log("ACTS_NewWant SecondAbility onNewWant uri :" + want.uri) - console.log("ACTS_NewWant SecondAbility onNewWant type :" + want.type) - console.log("ACTS_NewWant SecondAbility onNewWant flags :" + want.flags) - console.log("ACTS_NewWant SecondAbility onNewWant action :" + want.action) - var publishData = { - data: want.action - } - commonEvent.publish("onNewWantSecond_To_Test_CommonEvent", publishData,() => { - console.log("ACTS_NewWant SecondAbility Publish CallBack onNewWantSecond_To_Test_CommonEvent") - }); - } -}; diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index 5bde1967aff83021cc6c8445c9a6588a15e9dadc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,52 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -// import commonEvent from '@ohos.commonEvent' - -export default class ServiceAbility extends ServiceExtension { - onCreate(want, startId) { - globalThis.abilityWant = want; - console.log('ACTS_NewWant ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ACTS_NewWant ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); - } - - onConnect(want) { - var connId; - console.log('ACTS_NewWant ServiceAbility onConnect, want:' + want.abilityName); - globalThis.extensionContext = this.context - if (globalThis.abilityWant.action == 'connectServiceAbility0700') { - console.log('ACTS_NewWant ServiceAbility onConnect, action:' + globalThis.abilityWant.action); - this.context.startAbility( - { - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.SecondAbility", - action: "restartSecondAbility0700" - }, - ) - } - } - - onDisconnect(want) { - console.log('ACTS_NewWant ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ACTS_NewWant ServiceAbility onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index ec61f51e52e37bdc07570771f3a0373033941aab..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,38 +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.ets" -//import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear() { - console.info("start run testcase!!!!") - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('NewWantHapA MainAbility') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index f9496184771ff98f0ce1d3e05d310d8594e015df..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,24 +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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 1f4b8cf4618b0e2bfe187886920ccb54ac9207df..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,67 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets deleted file mode 100755 index fb3f76a5e2c37cb43f76cf77241554e916cb7ec8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets +++ /dev/null @@ -1,653 +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 "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -import missionManager from '@ohos.application.missionManager' -import appManager from '@ohos.application.appManager' - -const MAX_MISSION_NUM = 1024; -var subscriberInfo = { - events: ['onCreateMain_To_Test_CommonEvent', - 'onWindowStageCreateMain_To_Test_CommonEvent', - 'onForegroundMain_To_Test_CommonEvent', - 'onNewWantMain_To_Test_CommonEvent', - 'onCreateSecond_To_Test_CommonEvent', - 'onWindowStageCreateSecond_To_Test_CommonEvent', - 'onForegroundSecond_To_Test_CommonEvent', - 'onNewWantSecond_To_Test_CommonEvent', - ], -}; - -function getMissionId() { - return new Promise(async (resolve, reject) => { - var missionId = -1; - var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); - console.log('======>ACTS_NewWant_Test getMissionId missionInfos<=======' + missionInfos); - for (let i = 0; i < missionInfos.length; i++) { - console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i])) - if ((missionInfos[i].want.abilityName == "com.example.newwanttest.MainAbility") && - (missionInfos[i].runningState == 0)) { - missionId = missionInfos[i].missionId; - break; - } - } - console.log('======>ACTS_NewWant_Test getMissionId resolve missionId<=======' + missionId); - resolve(missionId); - }) -} - -export default function abilityTest(abilityContext) { - describe('ActsNewWantTest', function () { - - afterEach(async (done) => { - - var testMissionId; - testMissionId = await getMissionId(); - console.log('======>ACTS_NewWant_Test afterEach test missionId<=======' + testMissionId); - await missionManager.moveMissionToFront(testMissionId); - console.log('======>ACTS_NewWant_Test afterEach test move<======='); - - await appManager.killProcessesByBundleName("com.example.newwanthapapi7"); - await appManager.killProcessesByBundleName("com.example.newwanthapa"); - await appManager.killProcessesByBundleName("com.example.newwanthap"); - - done(); - }) - - /** - * @tc.number: ACTS_NewWant_Test_0100 - * @tc.name: Starting standard Ability for the first time does not trigger onNewWant. - * @tc.desc: Starting standard Ability for the first time does not trigger onNewWant. - */ - it('ACTS_NewWant_Test_0100', 0, async function (done) { - console.log("ACTS_NewWant_Test_0100 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.MainAbility" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0100 - startAbility start standard: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0100====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0100====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0100====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateMain_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateMain_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundMain_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantMain_To_Test_CommonEvent': - flagOnNewWant++; - break; - } - console.debug("ACTS_NewWant_Test_0100====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0100====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0100====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0100====>flagOnNewWant:====>" - + flagOnNewWant) - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 1 && flagOnNewWant == 0) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(1); - expect(flagOnNewWant).assertEqual(0); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0100====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0200 - * @tc.name: Starting singleton Ability for the first time does not trigger onNewWant. - * @tc.desc: Starting singleton Ability for the first time does not trigger onNewWant. - */ - it('ACTS_NewWant_Test_0200', 0, async function (done) { - console.log("ACTS_NewWant_Test_0200 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.SecondAbility" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0200 - startAbility start singleton: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0200====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0200====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0200====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateSecond_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateSecond_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundSecond_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantSecond_To_Test_CommonEvent': - flagOnNewWant++; - break; - } - console.debug("ACTS_NewWant_Test_0200====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0200====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0200====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0200====>flagOnNewWant:====>" - + flagOnNewWant) - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 1 && flagOnNewWant == 0) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(1); - expect(flagOnNewWant).assertEqual(0); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0200====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0300 - * @tc.name: Starting standard ability the second time does not trigger onNewWant. - * @tc.desc: Starting standard ability the second time does not trigger onNewWant. - */ - it('ACTS_NewWant_Test_0300', 0, async function (done) { - console.log("ACTS_NewWant_Test_0300 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.MainAbility", - action: "startStandard0300" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0300 - startAbility start standard: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0300====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0300====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0300====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateMain_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateMain_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundMain_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantMain_To_Test_CommonEvent': - flagOnNewWant++; - break; - } - console.debug("ACTS_NewWant_Test_0300====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0300====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0300====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0300====>flagOnNewWant:====>" - + flagOnNewWant) - - if (flagOnCreate == 2 && flagOnWindowStageCreate == 2 - && flagOnForeground == 2 && flagOnNewWant == 0) { - expect(flagOnCreate).assertEqual(2); - expect(flagOnWindowStageCreate).assertEqual(2); - expect(flagOnForeground).assertEqual(2); - expect(flagOnNewWant).assertEqual(0); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0300====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0400 - * @tc.name: Two abilities of the same hap - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_NewWant_Test_0400', 0, async function (done) { - console.log("ACTS_NewWant_Test_0400 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.SecondAbility", - action: "startSingleton0400" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0400 - startAbility start singleton: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0400====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0400====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0400====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateSecond_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateSecond_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundSecond_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantSecond_To_Test_CommonEvent': - flagOnNewWant++; - expect(data.data).assertEqual('restartSingleton'); - break; - } - console.debug("ACTS_NewWant_Test_0400====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0400====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0400====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0400====>flagOnNewWant:====>" - + flagOnNewWant) - - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 2 && flagOnNewWant == 1) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(2); - expect(flagOnNewWant).assertEqual(1); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0400====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0500 - * @tc.name: Two haps of the same app - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_NewWant_Test_0500', 0, async function (done) { - console.log("ACTS_NewWant_Test_0500 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapb.MainAbility", - action: "startHapB" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0500 - startAbility start HapB: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0500====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0500====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0500====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateMain_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateMain_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundMain_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantMain_To_Test_CommonEvent': - flagOnNewWant++; - expect(data.data).assertEqual('restartHapB'); - break; - } - console.debug("ACTS_NewWant_Test_0500====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0500====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0500====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0500====>flagOnNewWant:====>" - + flagOnNewWant) - - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 2 && flagOnNewWant == 1) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(2); - expect(flagOnNewWant).assertEqual(1); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0500====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0600 - * @tc.name: Cross-application - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_NewWant_Test_0600', 0, async function (done) { - console.log("ACTS_NewWant_Test_0600 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthapa", - abilityName: "com.example.newwanthapc.MainAbility", - action: "startHapC" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0600 - startAbility start HapC: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0600====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0600====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0600====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateMain_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateMain_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundMain_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantMain_To_Test_CommonEvent': - flagOnNewWant++; - expect(data.data).assertEqual('restartHapC'); - break; - } - console.debug("ACTS_NewWant_Test_0600====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0600====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0600====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0600====>flagOnNewWant:====>" - + flagOnNewWant) - - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 2 && flagOnNewWant == 1) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(2); - expect(flagOnNewWant).assertEqual(1); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0600====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0700 - * @tc.name: Service ability - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_NewWant_Test_0700', 0, async function (done) { - console.log("ACTS_NewWant_Test_0700 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.SecondAbility", - action: "startSecondAbility0700" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0700 - startAbility start SecondAbility: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0700====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0700====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0700====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateSecond_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateSecond_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundSecond_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantSecond_To_Test_CommonEvent': - flagOnNewWant++; - expect(data.data).assertEqual('restartSecondAbility0700'); - break; - } - console.debug("ACTS_NewWant_Test_0700====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0700====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0700====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0700====>flagOnNewWant:====>" - + flagOnNewWant) - - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 2 && flagOnNewWant == 1) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(2); - expect(flagOnNewWant).assertEqual(1); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0700====>UnSubscribe CallBack====>"); - done(); - } - }) - - /** - * @tc.number: ACTS_NewWant_Test_0800 - * @tc.name: API8 startup API7 - * @tc.desc: Starting singleton ability the second time does triggers onNewWant. - */ - it('ACTS_NewWant_Test_0800', 0, async function (done) { - console.log("ACTS_NewWant_Test_0800 --- start") - var Subscriber; - var flagOnCreate = 0; - var flagOnWindowStageCreate = 0; - var flagOnForeground = 0; - var flagOnNewWant = 0; - - abilityContext.startAbility({ - bundleName: "com.example.newwanthap", - abilityName: "com.example.newwanthapa.SecondAbility", - action: "startSecondAbility0800" - }, (error, data) => { - console.log('ACTS_NewWant_Test_0800 - startAbility start SecondAbility: ' - + JSON.stringify(error) + ", " + JSON.stringify(data)) - }) - - commonEvent.createSubscriber(subscriberInfo).then(async (data) => { - console.debug("ACTS_NewWant_Test_0800====>Create Subscriber====>"); - Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - - function SubscribeCallBack(err, data) { - - console.debug("ACTS_NewWant_Test_0800====>Subscribe CallBack data:====>" - + JSON.stringify(data)); - console.debug("ACTS_NewWant_Test_0800====>Subscribe CallBack data.event:====>" - + JSON.stringify(data.event)); - switch (data.event) { - case 'onCreateSecond_To_Test_CommonEvent': - flagOnCreate++; - break; - case 'onWindowStageCreateSecond_To_Test_CommonEvent': - flagOnWindowStageCreate++; - break; - case 'onForegroundSecond_To_Test_CommonEvent': - flagOnForeground++; - break; - case 'onNewWantSecond_To_Test_CommonEvent': - flagOnNewWant++; - expect(data.data).assertEqual('restartSecondAbility0800'); - break; - } - console.debug("ACTS_NewWant_Test_0800====>flagOnCreate:====>" - + flagOnCreate) - console.debug("ACTS_NewWant_Test_0800====>flagOnWindowStageCreate:====>" - + flagOnWindowStageCreate) - console.debug("ACTS_NewWant_Test_0800====>flagOnForeground:====>" - + flagOnForeground) - console.debug("ACTS_NewWant_Test_0800====>flagOnNewWant:====>" - + flagOnNewWant) - - if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 2 && flagOnNewWant == 1) { - expect(flagOnCreate).assertEqual(1); - expect(flagOnWindowStageCreate).assertEqual(1); - expect(flagOnForeground).assertEqual(2); - expect(flagOnNewWant).assertEqual(1); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - } - function UnSubscribeCallback() { - console.debug("ACTS_NewWant_Test_0800====>UnSubscribe CallBack====>"); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/test/List.test.ets deleted file mode 100755 index 64b2a602ef6008d172769f05b9a6c07ad9fe6db5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/test/List.test.ets +++ /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 abilityTest from './Ability.test.ets' - - -export default function testsuite(context) { - - abilityTest(context) - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/app.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/app.json deleted file mode 100755 index 5ce28640c9db3948d59a6a6c0ef3ec4afc6a4e10..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsabilitypermissiontest", - "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/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/Test.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/Test.json deleted file mode 100755 index 40ee14906032c8a2ea5cdeca9605fa0aa5bb12ad..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/Test.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "300000", - "package": "com.example.actsabilitypermissiontest", - "shell-timeout": "300000" - }, - "kits": [ - { - "test-file-name": [ - "ActsSystemAppATest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - }, - { - "type": "PushKit", - "push": [ - "ActsSystemAppATest.hap->/system/app/ActsSystemAppATest.hap" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "acm create -n 101 -t normal", - "acm switch -i 101" - ] - }, - { - "type": "PushKit", - "push": [ - "ActsSystemAppOneRelyHap.hap->/system/app/ActsSystemAppOneRelyHap.hap" - ] - }, - { - "test-file-name": [ - "ActsSystemAppOneRelyHap.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "acm switch -i 100" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 644 /data/*.hap" - ] - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 8084b50ef553d46316625d9047b7daabebd2e7d8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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; - } - - 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") - globalThis.abilityContext = this.context - 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/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100755 index d33842fdab50ead4f08061b92e7e2aad6747b47b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,57 +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' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne1() { - console.debug("====>Publish CallBack ACTS_ThirdPartyAbilityPermission_0100_CommonEvent====>"); - globalThis.ability2Context.terminateSelf(); - console.debug("====>close this context====>") -} - - -export default class MainAbility2 extends Ability { - - onCreate(want, launchParam) { - console.log("MainAbility2 onCreate") - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility2 onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index/index2", null) - globalThis.ability2Context = this.context; - commonEvent.publish("ACTS_AbilityPermission_0100_Start_CommonEvent", PublishCallBackOne1); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("MainAbility2 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("MainAbility2 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("MainAbility2 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 6f254e65161679e8034527ea64867819d5ff38c1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index.ets +++ /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 file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" -import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/AbilityPermission.test.ets b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/AbilityPermission.test.ets deleted file mode 100755 index 1155a26574b92668aa84d45c5a7b9bbdb180e2b8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/AbilityPermission.test.ets +++ /dev/null @@ -1,274 +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. - */ -// @ts-nocheck -import osaccount from '@ohos.account.osaccount' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import commonEvent from '@ohos.commonEvent' -var AbilityPermission1 = { - events: ["ACTS_AbilityPermission_0100_Start_CommonEvent"] -} -var AbilityPermission3 = { - events: ["ACTS_AbilityPermission_0300_Start_CommonEvent"] -} -var AbilityPermission4 = { - events: ["ACTS_AbilityPermission_0400_Start_CommonEvent"] -} -var AbilityPermission6 = { - events: ["ACTS_AbilityPermission_0600_Start_CommonEvent"] -} -const START_ABILITY_TIMEOUT = 3000; -export default function abilityPermissionTest(abilityContext) { - describe('ActsAbilityPermissionTest', function () { - var osAccountManager = osaccount.getAccountManager(); - var userA; - var userB; - beforeAll(async function(done){ - osAccountManager.getOsAccountLocalIdFromProcess().then((data)=>{ - userA = data - userB=userA+1 - console.log("userA=====>"+userA) - done() - }); - - }) - afterAll(async function(done){ - await osAccountManager.removeOsAccount(userB, (err)=>{ - console.debug("====>remove localId: " + userB + " err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - }) - - /* - * @tc.number: ACTS_AbilityPermission_0100 - * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start - * @tc.desc: Start an ability that belongs to the current user with the current user - */ - it('ACTS_AbilityPermission_0100', 0, async function (done) { - console.log("ACTS_AbilityPermission_0100====>callback start====>") - var Subscriber; - var flag = true; - - function SubscribeCallBack(err, data) { - console.debug("ACTS_AbilityPermission_0100====>Subscribe CallBack data:====>" + JSON.stringify(data)); - expect(data.event == 'ACTS_AbilityPermission_0100_Start_CommonEvent').assertTrue() - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - - commonEvent.createSubscriber(AbilityPermission1).then(async (data) => { - console.debug("ACTS_AbilityPermission_0100====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility_100====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actsabilitypermissiontest', - abilityName: 'com.example.actsabilitypermissiontest.MainAbility2' - }, userA, () => { - console.debug("====>startAbility end_100====>"); - }) - }) - - function UnSubscribeCallback() { - flag = false - console.debug("ACTS_AbilityPermission_0100====>UnSubscribe CallBack====>"+flag); - done(); - } - setTimeout(()=>{ - if (flag == true) { - expect().assertFail(); - console.debug('in ACTS_AbilityPermission_0100====>timeout====>'+flag); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - console.debug('ACTS_AbilityPermission_0100====>timeout====>'); - }, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number: ACTS_AbilityPermission_0300 - * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start - * @tc.desc: Start an ability under user U101 with the current user - */ - it('ACTS_AbilityPermission_0300', 0, async function (done) { - console.log("ACTS_AbilityPermission_0300====>callback start====>") - var Subscriber - var flag = 0; - console.debug("====>get AccountManager finish===="); - - function SubscribeCallBack(err, data) { - console.debug("ACTS_AbilityPermission_0300====>Subscribe CallBack data:====>" + JSON.stringify(data)); - expect(data.event == 'ACTS_AbilityPermission_0300_Start_CommonEvent').assertTrue() - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - commonEvent.createSubscriber(AbilityPermission3).then(async (data) => { - console.debug("ACTS_AbilityPermission_0300====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility_0300====>"); - await abilityContext.startAbilityWithAccount( - { - bundleName: 'com.example.actssystemappuonehundredonerelytest', - abilityName: 'com.example.actssystemappuonehundredonerelytest.MainAbility' - }, userA ).then().catch((err) => { - console.debug("ACTS_AbilityPermission_0300====>" + err) - - console.debug("====>startAbility end_0300====>"); - }) - }) - function UnSubscribeCallback() { - if(flag == 0) { - expect().assertFail(); - } - console.debug("ACTS_AbilityPermission_0300====>UnSubscribe CallBack====>"); - done(); - } - function timeout() { - console.debug('ACTS_AbilityPermission_0300====>timeout====>'); - if(flag == 0){ - flag = 1; - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number: ACTS_AbilityPermission_0400 - * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start - * @tc.desc: Bind an Ability to which you belong with the current user - */ - it('ACTS_AbilityPermission_0400', 0, async function (done) { - console.log("ACTS_AbilityPermission_0400====>callback start====>") - let Subscriber - var flag = true - - function SubscribeCallBack(err, data) { - expect(data.event == "ACTS_AbilityPermission_0400_Start_CommonEvent").assertTrue(); - console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - abilityContext.disconnectAbility(globalThis.number).then((data) => { - console.debug("====>data is====>" + JSON.stringify(data)); - }) - console.log('====>disconnectAbility finish'); - } - - function onConnectCallback(element, remote) { - console.log('ACTS_AbilityPermission_0400_Start_CommonEvent onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_AbilityPermission_0400_Start_CommonEvent onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(() => { - console.log('====>in timeout'); - console.debug("====>flag is====>" + JSON.stringify(flag)); - if (flag == true) { - console.debug('ACTS_AbilityPermission_0400_Start_CommonEvent - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - } - }, 1000); - } - - function onDisconnectCallback(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - - function onFailedCallback(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - - commonEvent.createSubscriber(AbilityPermission4).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbilityWithAccount( - { - bundleName: 'com.example.actsabilitypermissiontest', - abilityName: 'com.example.actsabilitypermissiontest.ServiceAbility', - action: "StartAbilityPromise" - }, userA, { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) - - function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); - flag = false - done() - } - - function timeout() { - console.debug('in ACTS_AbilityPermission_0400_Start_CommonEvent timeout'); - if (flag == true) { - expect().assertFail(); - console.debug('ACTS_AbilityPermission_0400_Start_CommonEvent - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - setTimeout(timeout, START_ABILITY_TIMEOUT); - }) - - /* - * @tc.number: ACTS_AbilityPermission_0600 - * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start - * @tc.desc: Bind a U101 Ability with the current user - */ - it('ACTS_AbilityPermission_0600', 0, async function (done) { - console.log("ACTS_AbilityPermission_0600====>callback start====>") - let Subscriber - let connId - function onConnectCallbackC(element, remote) { - console.log('ACTS_AbilityPermission_0600_Start_CommonEvent onConnectCallback====> element=' + JSON.stringify(element)); - console.log('ACTS_AbilityPermission_0600_Start_CommonEvent onConnectCallback====> remote=' + JSON.stringify(remote)); - expect().assertFail(); - } - function onDisconnectCallbackC(element) { - console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); - } - function onFailedCallbackC(code) { - console.log('onFailedCallback====> code=' + JSON.stringify(code)) - } - function SubscribeCallBackF(err, data) { - console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); - } - function UnSubscribeCallbackF() { - console.debug("====>UnSubscribeCallback====>"); - } - commonEvent.createSubscriber(AbilityPermission6).then(async (data) => { - console.debug("====>Create Subscriber====>"); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBackF); - }) - console.debug("====>0600start connectAbility====>"); - connId = await abilityContext.connectAbilityWithAccount( - { - bundleName: 'com.example.actssystemappuonehundredonerelytest', - abilityName: 'com.example.actssystemappuonehundredonerelytest.ServiceAbility', - action: "StartAbilityPromise" - }, userA, { - onConnect: onConnectCallbackC, - onDisconnect: onDisconnectCallbackC, - onFailed: onFailedCallbackC - }) - console.debug("====>number is====>" + JSON.stringify(connId)); - setTimeout(() =>{ - console.debug('in ACTS_AbilityPermission_0600_Start_CommonEvent timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallbackF) - done() - }, START_ABILITY_TIMEOUT); - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/List.test.ets deleted file mode 100755 index c3f15765b2bc58fe35d8411173ec242e0fbb1d2e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +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 abilityPermissionText from './AbilityPermission.test.ets' - -export default function testsuite(context) { - abilityPermissionText(context) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/module.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/module.json deleted file mode 100755 index ddbd5e11855d5f31c8ab49c6950308e17f62f8b0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/module.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "module": { - "name": "com.example.actsabilitypermissiontest", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actsabilitypermissiontest.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" - ] - } - ] - }, - { - "name": "com.example.actsabilitypermissiontest.MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.actsabilitypermissiontest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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" - }, - { - "name":"ohos.permission.MANAGE_LOCAL_ACCOUNTS", - "reason":"need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" - }, - { - "name":"ohos.permission.INTERACT_ACROSS)LOCAL_ACCOUNTS_EXTENSION", - "reason":"need use ohos.permission.INTERACT_ACROSS)LOCAL_ACCOUNTS_EXTENSION" - }, - { - "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", - "reason":"need use ohos.permission.GET_RUNNING_INFO" - } - ] - } -} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/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/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/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/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/app.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/app.json deleted file mode 100755 index 18517fb4971dd5588a86c493accf5bda6d20d4d7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.acts.pmvendorappa", - "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/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/BUILD.gn b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/BUILD.gn deleted file mode 100755 index 29f5958dfdb3899771a84dfff99cf7445eeb3860..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/BUILD.gn +++ /dev/null @@ -1,40 +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_js_hap_suite("ActsSystemAppOneRelyHap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":acts_systemappone_rely_test_js_assets", - ":acts_systemappone_rely_test_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsSystemAppOneRelyHap" -} - -ohos_app_scope("acts_systemappone_rely_test_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("acts_systemappone_rely_test_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("acts_systemappone_rely_test_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":acts_systemappone_rely_test_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/Test.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index bca5b9f27ecd901dd80519895934adaab59a1269..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' -function PublishCallBackOne3() { - console.debug("====>Publish CallBack ACTS_StartAbility_0300_CommonEvent====>"); - setTimeout(globalThis.abilityContext.terminateSelfWithResult(()=>{ - console.debug("====>terminateSelfWithResult succese====>") - }),1000) -} - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context - commonEvent.publish("ACTS_AbilityPermission_0300_Start_CommonEvent", PublishCallBackOne3); - 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/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json deleted file mode 100755 index 4368135e3eb898185cf91bb30b831f37fb40a10e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "module": { - "name": "com.example.actssystemappuonehundredonerelytest", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.actssystemappuonehundredonerelytest.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.actssystemappuonehundredonerelytest.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - } - ] - } -} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/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/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/app.json deleted file mode 100755 index 6ee7789158606606bfa9ef49384505f61b912da1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapa", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index c7512768c85152bb4edb3d32dbc87ec725172075..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,56 +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' -import commonEvent from '@ohos.commonEvent' - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("ACTS_Process_MultiInstance_HapAA MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_Process_MultiInstance_HapAA MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_Process_MultiInstance_HapAA MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - - commonEvent.publish("HapAA_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapAA Publish CallBack HapAA_To_Test_CommonEvent") - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_Process_MultiInstance_HapAA MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("ACTS_Process_MultiInstance_HapAA MainAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("ACTS_Process_MultiInstance_HapAA MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json deleted file mode 100755 index 446592a4a927b92ce50acd0133907ba243939177..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapaa", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapaa.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/app.json deleted file mode 100755 index 6ee7789158606606bfa9ef49384505f61b912da1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapa", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index a470e0e6895ea60a3cf175cfcabb4a7dc3fcf019..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,56 +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' -import commonEvent from '@ohos.commonEvent' - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("ACTS_Process_MultiInstance_HapAB MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_Process_MultiInstance_HapAB MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_Process_MultiInstance_HapAB MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - - commonEvent.publish("HapAB_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapAB Publish CallBack HapAB_To_Test_CommonEvent") - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_Process_MultiInstance_HapAB MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("ACTS_Process_MultiInstance_HapAB MainAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("ACTS_Process_MultiInstance_HapAB MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json deleted file mode 100755 index 3193a5605479849365d3bb60edc4d37bd8665579..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapab", - "process": "com.example.multiinstancehapb", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapab.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/app.json deleted file mode 100755 index 76222f851e61f51a03ff471901db40753056811d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapb", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index dd59392254e4b0b2dc30810ac52be12b4c834058..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' - -let connectionId = -1; - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context; - - let context = this.context; - - 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("ACTS_Process_MultiInstance_HapBA MainAbility onForeground") - commonEvent.publish("HapBA_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapBA Publish CallBack HapBA_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json deleted file mode 100755 index e1da94c048965f6d6ad4ad79fcb77a4e3c459b51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapba", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapba.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/app.json deleted file mode 100755 index 76222f851e61f51a03ff471901db40753056811d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapb", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 0d81d758729714a2cafcec9a6e780340334cb934..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' - -let connectionId = -1; - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context; - - let context = this.context; - - 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("ACTS_Process_MultiInstance_HapBB MainAbility onForeground") - commonEvent.publish("HapBB_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapBB Publish CallBack HapBB_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json deleted file mode 100755 index e4b42227e3264d56542896c78e078b8ea3a2505a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapbb", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapbb.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/app.json deleted file mode 100755 index 76222f851e61f51a03ff471901db40753056811d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapb", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 0e5544d92bbb2dadad42651500b8bfa55a9cff34..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' - -let connectionId = -1; - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context; - - let context = this.context; - - 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("ACTS_Process_MultiInstance_HapBC MainAbility onForeground") - commonEvent.publish("HapBC_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapBC Publish CallBack HapBC_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json deleted file mode 100755 index d2d2f40655aadee00aea9911c317f4972104a925..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapbc", - "process": "com.example.multiinstancehapc", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapbc.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/app.json deleted file mode 100755 index 76222f851e61f51a03ff471901db40753056811d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapb", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index b15976050817e421f79da664b5815e98fa71a2ee..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' - -let connectionId = -1; - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context; - - let context = this.context; - - 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("ACTS_Process_MultiInstance_HapBD MainAbility onForeground") - commonEvent.publish("HapBD_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapBD Publish CallBack HapBD_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json deleted file mode 100755 index 63cfcda752b11f9b0987415bd8f3ce3472289e93..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapbd", - "process": "com.example.multiinstancehapc", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapbd.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/app.json deleted file mode 100755 index 76222f851e61f51a03ff471901db40753056811d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapb", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 099b49aa8cd32fcb2f106d7374fa4091b89d141d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' - -let connectionId = -1; - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context; - - let context = this.context; - - 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("ACTS_Process_MultiInstance_HapBE MainAbility onForeground") - commonEvent.publish("HapBE_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapBE Publish CallBack HapBE_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json deleted file mode 100755 index 0e86d9f9494f46ad1c51df84d6a01dab7f0bebcb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapbe", - "process": "com.example.multiinstancehapa", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapbe.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/app.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/app.json deleted file mode 100755 index 76222f851e61f51a03ff471901db40753056811d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.multiinstancehapb", - "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/Test.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 89d0d0dd5ca2415c9366b5a7695759f92d736e79..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,59 +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' -import commonEvent from '@ohos.commonEvent' - -let connectionId = -1; - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") - globalThis.abilityWant = want; - } - - 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") - globalThis.abilityContext = this.context; - - let context = this.context; - - 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("ACTS_Process_MultiInstance_HapBF MainAbility onForeground") - commonEvent.publish("HapBF_To_Test_CommonEvent", () => { - console.log("ACTS_Process_MultiInstance_HapBF Publish CallBack HapBF_To_Test_CommonEvent") - }); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json deleted file mode 100755 index e3a2ad35e22b8f34607c0441e6bac4d6698ea910..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "module": { - "name": "com.example.multiinstancehapbf", - "process": "com.example.multiinstancehapb", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.multiinstancehapbf.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" - ] - } - ] - } - ] - } -} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/BUILD.gn b/aafwk/aafwk_standard/stage/BUILD.gn deleted file mode 100644 index 6a0cb71329634c8c29def55b72b732be802d3205..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/BUILD.gn +++ /dev/null @@ -1,26 +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") - -group("stage") { - testonly = true - if (is_standard_system) { - deps = [ - "actslifecyclemultihap2test:ActsLifecycleMultiHap2Test", - "actslifecyclemultihap3test:ActsLifecycleMultiHap3Test", - "actslifecyclemultihaptest:ActsLifecycleMultiHapTest", - "actslifecyclesinglehaptest:ActsLifecycleSingleHapTest", - ] - } -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/app.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/app.json deleted file mode 100644 index dbcb3167bafee0f81447033b7314c9af39fb55fc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.lifecycletest", - "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 - } - } -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/resources/base/element/string.json deleted file mode 100644 index 703846c232188d797b94c43c98a58166bc9f6d3f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"LifecycleHap2Test" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/BUILD.gn b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/BUILD.gn deleted file mode 100644 index af0d05bb6718c5cbeb354d39d7791fd05b698a07..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/BUILD.gn +++ /dev/null @@ -1,40 +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("ActsLifecycleMultiHap2Test") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actslifecyclemultihap2test_js_assets", - ":actslifecyclemultihap2test_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsLifecycleMultiHap2Test" -} - -ohos_app_scope("actslifecyclemultihap2test_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actslifecyclemultihap2test_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actslifecyclemultihap2test_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actslifecyclemultihap2test_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/Test.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/Test.json deleted file mode 100644 index 8e4f789b74d6e55350655efba2110c5399c6cc64..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.example.lifecycletest", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsLifecycleMultiHap2Test.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts deleted file mode 100644 index 92902fb7cb70fa80d0a5cc7fa51dd264512f87f6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts +++ /dev/null @@ -1,49 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility1 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility1 onCreate") - globalThis.abilityWant = want; - - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility1 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility1 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility1_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility1 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility1 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility1 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts deleted file mode 100644 index 875ee511c456b69bd78fe6230f34a3027b7ead83..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts +++ /dev/null @@ -1,49 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility10 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility10 onCreate") - globalThis.abilityWant = want; - - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility10 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility10 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility10_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility10 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility10 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility10 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts deleted file mode 100644 index 134264ca6d0382c86bfbcd9fc5a7c309d4a4a76a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts +++ /dev/null @@ -1,48 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility2 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility2 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility2 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility2_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility2 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility2 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility2 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts deleted file mode 100644 index ec0ead03bd97866beeac6c927d337201d73413a1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility3 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility3 onCreate") - globalThis.abilityWant = want; - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility3 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility3 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility3 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility3 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility3_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility3 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility3 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility3 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts deleted file mode 100644 index bc489ed8549c00b439e2075861f42e5a4a46d3e5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility4 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility4 onCreate") - globalThis.abilityWant = want; - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility4 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility4 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility4 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility4 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility4_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility4 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility4 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility4 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts deleted file mode 100644 index 0eac06dcb2d5323ec4e467a9e8a24e1c70d9c70d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility5 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility5 onCreate") - globalThis.abilityWant = want; - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility5 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility5 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility5 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility5 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility5_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility5 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility5 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility5 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts deleted file mode 100644 index ba35a38dd46fa3e12029de67ab3bc376236bfb17..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts +++ /dev/null @@ -1,55 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility6 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility6 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility6 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility6 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility6_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility6 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility6 onForeground") - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility6 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility6 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility6 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts deleted file mode 100644 index 0f181a7e765004b8775aa8d40763add6613c0d77..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility7 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility7 onCreate") - globalThis.abilityWant = want; - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility7 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility7 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility7 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility7 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility7_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility7 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility7 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility7 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts deleted file mode 100644 index 2e846ca0b96788679e52ad663816450e896a9769..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility8 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility8 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility8 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility8 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility8_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resourcesl - console.log("[Demo] Hap2MainAbility8 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility8 onForeground") - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility8 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility8 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 500) - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility8 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts deleted file mode 100644 index f8b7786533d860bcefd6217a9534385159a27717..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap2MainAbility9 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap2MainAbility9 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] Hap2MainAbility9 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap2MainAbility9 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap2MainAbility9_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap2MainAbility9 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap2MainAbility9 onForeground") - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility9 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap2MainAbility9 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 500) - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap2MainAbility9 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets deleted file mode 100644 index f0a9dc55f529903a11241428ea20cb71507675b3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility10_pages { - @State message: string = 'Hap2MainAbility10' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets deleted file mode 100644 index de7084b00b36a73ba38cc8d5f29199848a233c0d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility1_pages { - @State message: string = 'Hap2MainAbility1' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets deleted file mode 100644 index c7c165bb05cfefe18ef78bc08bb2fe4e38bc5128..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility2_pages { - @State message: string = 'Hap2MainAbility2' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets deleted file mode 100644 index 01e584748395bf89f75a3692159871c326a6b553..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility3_pages { - @State message: string = 'Hap2MainAbility3' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets deleted file mode 100644 index b96453972993257e2277688659286987c7bd1734..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility4_pages { - @State message: string = 'Hap2MainAbility4' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets deleted file mode 100644 index f9847ac7ad9b9e621393261d72a1c8225761e7a1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility5_pages { - @State message: string = 'Hap2MainAbility5' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets deleted file mode 100644 index d58d252a7c3ab39b4d672a6a43393a0a54b3a8b9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility6_pages { - @State message: string = 'Hap2MainAbility6' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets deleted file mode 100644 index 9f3028bcc0ad314575d4ed84e5548a68d8a52c95..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility7_pages { - @State message: string = 'Hap2MainAbility7' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets deleted file mode 100644 index 46634dbb2ea50e174a11141083bf254c5ecaf122..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility8_pages { - @State message: string = 'Hap2MainAbility8' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets deleted file mode 100644 index 0d5b7089d1b21c12103204a151f60563260fe70f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap2MainAbility9_pages { - @State message: string = 'Hap2MainAbility9' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/module.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/module.json deleted file mode 100644 index 70180fed43f387d75273cf2bb8102013fc90c7f5..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/module.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "module": { - "name": "hap2", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:hap2_desc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [{ - "name": "com.example.lifecycletest.Hap2MainAbility1", - "srcEntrance": "./ets/Hap2MainAbility1/Hap2MainAbility1.ts", - "description": "$string:Hap2MainAbility1_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility1_label", - "visible": true, - "orientation": "portrait", - "skills": [{ - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - }] - }, - { - "name": "Hap2MainAbility2", - "srcEntrance": "./ets/Hap2MainAbility2/Hap2MainAbility2.ts", - "description": "$string:Hap2MainAbility2_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility2_label" - }, - { - "name": "Hap2MainAbility3", - "srcEntrance": "./ets/Hap2MainAbility3/Hap2MainAbility3.ts", - "description": "$string:Hap2MainAbility3_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility3_label" - }, - { - "name": "Hap2MainAbility4", - "srcEntrance": "./ets/Hap2MainAbility4/Hap2MainAbility4.ts", - "description": "$string:Hap2MainAbility4_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility4_label", - "launchType": "singleton" - }, - { - "name": "Hap2MainAbility5", - "srcEntrance": "./ets/Hap2MainAbility5/Hap2MainAbility5.ts", - "description": "$string:Hap2MainAbility5_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility5_label", - "launchType": "standard" - }, - { - "name": "Hap2MainAbility6", - "srcEntrance": "./ets/Hap2MainAbility6/Hap2MainAbility6.ts", - "description": "$string:Hap2MainAbility6_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility6_label" - }, - { - "name": "Hap2MainAbility7", - "srcEntrance": "./ets/Hap2MainAbility7/Hap2MainAbility7.ts", - "description": "$string:Hap2MainAbility7_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility7_label" - }, - { - "name": "Hap2MainAbility8", - "srcEntrance": "./ets/Hap2MainAbility8/Hap2MainAbility8.ts", - "description": "$string:Hap2MainAbility8_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility8_label" - }, - { - "name": "Hap2MainAbility9", - "srcEntrance": "./ets/Hap2MainAbility9/Hap2MainAbility9.ts", - "description": "$string:Hap2MainAbility9_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility9_label" - }, - { - "name": "Hap2MainAbility10", - "srcEntrance": "./ets/Hap2MainAbility10/Hap2MainAbility10.ts", - "description": "$string:Hap2MainAbility10_desc", - "icon": "$media:icon", - "label": "$string:Hap2MainAbility10_label" - }], - "requestPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.MANAGE_MISSIONS" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/element/string.json deleted file mode 100644 index fa3564466b0571552e6ddba32daa26924eb2cf31..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,120 +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": "ActsLifecycleMultihapTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "hap2_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "Hap2MainAbility1_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility1_label", - "value": "label" - }, - { - "name": "Hap2MainAbility2_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility2_label", - "value": "label" - }, - { - "name": "Hap2MainAbility3_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility3_label", - "value": "label" - }, - { - "name": "Hap2MainAbility4_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility4_label", - "value": "label" - }, - { - "name": "Hap2MainAbility5_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility5_label", - "value": "label" - }, - { - "name": "Hap2MainAbility6_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility6_label", - "value": "label" - }, - { - "name": "Hap2MainAbility7_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility7_label", - "value": "label" - }, - { - "name": "Hap2MainAbility8_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility8_label", - "value": "label" - }, - { - "name": "Hap2MainAbility9_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility9_label", - "value": "label" - }, - { - "name": "Hap2MainAbility10_desc", - "value": "description" - }, - { - "name": "Hap2MainAbility10_label", - "value": "label" - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/app.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/app.json deleted file mode 100644 index dbcb3167bafee0f81447033b7314c9af39fb55fc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.lifecycletest", - "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 - } - } -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/resources/base/element/string.json deleted file mode 100644 index bc3d61635d4f034e9b27f3bcd65c26d7d909eb2c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"LifecycleHap3Test" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/BUILD.gn b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/BUILD.gn deleted file mode 100644 index 80025dd9365227078d2073a40b7559cff11b0e71..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/BUILD.gn +++ /dev/null @@ -1,40 +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("ActsLifecycleMultiHap3Test") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actslifecyclemultihap3test_js_assets", - ":actslifecyclemultihap3test_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsLifecycleMultiHap3Test" -} - -ohos_app_scope("actslifecyclemultihap3test_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actslifecyclemultihap3test_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actslifecyclemultihap3test_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actslifecyclemultihap3test_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/Test.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/Test.json deleted file mode 100644 index 2ebc64067f3be6d3d6e7e41f43dbf1f65b23ba0d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.example.lifecycletest", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsLifecycleMultiHap3Test.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts deleted file mode 100644 index 413d94ef97f0dfcc67191b87e0aca74c0931d908..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts +++ /dev/null @@ -1,49 +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 commonEvent from '@ohos.commonEvent'; -import Ability from '@ohos.application.Ability' - -export default class Hap3MainAbility1 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap3MainAbility1 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] Hap3MainAbility1 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap3MainAbility1 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap3MainAbility1_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap3MainAbility1 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap3MainAbility1 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap3MainAbility1 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts deleted file mode 100644 index 18ccf45c0d6ffb743a84dacfb6125ac53413f34d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts +++ /dev/null @@ -1,56 +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 Ability from '@ohos.application.Ability' - -export default class Hap3MainAbility2 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap3MainAbility2 onCreate") - globalThis.abilityWant = want; - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap3MainAbility2 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap3MainAbility2 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap3MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap3MainAbility2 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap3MainAbility2_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap3MainAbility2 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap3MainAbility2 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap3MainAbility2 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts deleted file mode 100644 index 427af1aa5cd62aed997c5f18348e0e7d2f04ca69..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts +++ /dev/null @@ -1,49 +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 commonEvent from '@ohos.commonEvent'; -import Ability from '@ohos.application.Ability' - -export default class Hap3MainAbility3 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap3MainAbility3 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] Hap3MainAbility3 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap3MainAbility3 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap3MainAbility3_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap3MainAbility3 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap3MainAbility3 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap3MainAbility3 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets deleted file mode 100644 index 6335bdfef370c8d0eb8fd34170f640c538485688..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap3MainAbility1_pages { - @State message: string = 'Hap3MainAbility1' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets deleted file mode 100644 index d1699b1cfd0f4734c2d27b64bac368b3e55b4f3b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap3MainAbility2_pages { - @State message: string = 'Hap3MainAbility2' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets deleted file mode 100644 index 54a73be4b5e4d76a5b61eefd89deee935bae418b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct Hap3MainAbility3_pages { - @State message: string = 'Hap3MainAbility3' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/module.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/module.json deleted file mode 100644 index 96baad0c53bd125a2189d3adc5e9596bc5538808..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/module.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "module": { - "name": "hap3", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:hap3_desc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [{ - "name": "com.example.lifecycletest.Hap3MainAbility1", - "srcEntrance": "./ets/Hap3MainAbility1/Hap3MainAbility1.ts", - "description": "$string:Hap3MainAbility1_desc", - "icon": "$media:icon", - "label": "$string:Hap3MainAbility1_label", - "visible": true, - "orientation": "portrait", - "skills": [{ - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - }] - }, - { - "name": "Hap3MainAbility2", - "srcEntrance": "./ets/Hap3MainAbility2/Hap3MainAbility2.ts", - "description": "$string:Hap3MainAbility2_desc", - "icon": "$media:icon", - "label": "$string:Hap3MainAbility2_label" - }, - { - "name": "Hap3MainAbility3", - "srcEntrance": "./ets/Hap3MainAbility3/Hap3MainAbility3.ts", - "description": "$string:Hap3MainAbility3_desc", - "icon": "$media:icon", - "label": "$string:Hap3MainAbility3_label" - }], - "requestPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.MANAGE_MISSIONS" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/element/string.json deleted file mode 100644 index d24c264cf58f498dd118b228d10c8a4b17c63f19..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,64 +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": "ActsLifecycleMultihapTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "hap3_desc", - "value": "description" - }, - { - "name": "Hap3MainAbility1_desc", - "value": "description" - }, - { - "name": "Hap3MainAbility1_label", - "value": "label" - }, - { - "name": "Hap3MainAbility2_desc", - "value": "description" - }, - { - "name": "Hap3MainAbility2_label", - "value": "label" - }, - { - "name": "Hap3MainAbility3_desc", - "value": "description" - }, - { - "name": "Hap3MainAbility3_label", - "value": "label" - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/app.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/app.json deleted file mode 100644 index dbcb3167bafee0f81447033b7314c9af39fb55fc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.lifecycletest", - "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 - } - } -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/resources/base/element/string.json deleted file mode 100644 index 09872b0a1cdccab33c20051972decaa72106573f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"LifecycleTest" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/BUILD.gn b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/BUILD.gn deleted file mode 100644 index a4b274a9d08404227b3fa0e4b1b3345127bdcadd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/BUILD.gn +++ /dev/null @@ -1,40 +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("ActsLifecycleMultiHapTest") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actslifecyclemultihaptest_js_assets", - ":actslifecyclemultihaptest_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsLifecycleMultiHapTest" -} - -ohos_app_scope("actslifecyclemultihaptest_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actslifecyclemultihaptest_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actslifecyclemultihaptest_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actslifecyclemultihaptest_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/Test.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/Test.json deleted file mode 100644 index 5da5028964eeb898d8642b704b913d9dfe16bad4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.example.lifecycletest", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsLifecycleMultiHapTest.hap", - "ActsLifecycleMultiHap2Test.hap", - "ActsLifecycleMultiHap3Test.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index d0d4123abe4172c9f6c0a89763c87e48112db289..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,49 +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 Ability from '@ohos.application.Ability' - -export default class MainAbility extends Ability { - - onCreate(want, launchParam) { - console.log("[Demo] MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context; - windowStage.setUIContent(this.context, "pages/MainAbility_pages", 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") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts deleted file mode 100644 index 7f6d8d1d43a78d4e1408ccc639e766ed16ef330c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts +++ /dev/null @@ -1,116 +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 Ability from '@ohos.application.Ability' - -export default class MainAbility1 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility1 onCreate") - globalThis.abilityWant = want; - - var listKey = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityCreate") - listKey.push(abilityName +" onAbilityCreate"); - console.log("listKey is :" + listKey); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityWindowStageCreate") - listKey.push(abilityName +" onAbilityWindowStageCreate"); - console.log("listKey is :" + listKey); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityForeground") - listKey.push(abilityName +" onAbilityForeground"); - console.log("listKey is :" + listKey); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityBackground") - listKey.push(abilityName +" onAbilityBackground"); - console.log("listKey is :" + listKey); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityWindowStageDestroy") - listKey.push(abilityName +" onAbilityWindowStageDestroy"); - console.log("listKey is :" + listKey); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityDestroy") - listKey.push(abilityName +" onAbilityDestroy"); - console.log("listKey is :" + listKey); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityContinue") - listKey.push(abilityName +" onAbilityContinue"); - console.log("listKey is :" + listKey); - } - } - - globalThis.mainAbility1ListKey = listKey - var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); - globalThis.mainAbility1CallBackId = callBackId - setTimeout(() => { - console.log("listKey is :" + listKey); - console.log("callBackId is :" + callBackId); - this.context.getApplicationContext().unregisterAbilityLifecycleCallback (callBackId, (error, data)=> { - console.log("unRegisterAbilityLifecycleCallback err is :" + - JSON.stringify(error) + ",data is : " + JSON.stringify(data)) - }); - }, 4000) - - - setTimeout(()=>{ - this.context.terminateSelf().then((data) => { - console.log("[Demo] MainAbility1 terminateSelf windowStage data: " + JSON.stringify(data)) - }).catch((error) => { - console.log("[Demo] MainAbility1 terminateSelf windowStage error: " + JSON.stringify(error)) - }) - }, 3000) - } - - onDestroy() { - console.log("[Demo] MainAbility1 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility1 onWindowStageCreate") - globalThis.ability2Context = this.context; - windowStage.setUIContent(this.context, "pages/MainAbility1_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility1 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility1 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility1 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index b1b736c356597f3be490aebc2c629306d0f232b7..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,104 +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 Ability from '@ohos.application.Ability' - -export default class MainAbility2 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility2 onCreate") - globalThis.abilityWant = want; - - var listKey = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityCreate") - listKey.push(abilityName +" onAbilityCreate"); - console.log("listKey is :" + listKey); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityWindowStageCreate") - listKey.push(abilityName +" onAbilityWindowStageCreate"); - console.log("listKey is :" + listKey); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityForeground") - listKey.push(abilityName +" onAbilityForeground"); - console.log("listKey is :" + listKey); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityBackground") - listKey.push(abilityName +" onAbilityBackground"); - console.log("listKey is :" + listKey); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityWindowStageDestroy") - listKey.push(abilityName +" onAbilityWindowStageDestroy"); - console.log("listKey is :" + listKey); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityDestroy") - listKey.push(abilityName +" onAbilityDestroy"); - console.log("listKey is :" + listKey); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityContinue") - listKey.push(abilityName +" onAbilityContinue"); - console.log("listKey is :" + listKey); - } - } - - var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); - - setTimeout(() => { - globalThis.mainAbility2ListKey = listKey - globalThis.mainAbility2CallBackId = callBackId - console.log("listKey is :" + listKey); - console.log("callBackId is :" + callBackId); - }, 3000) - } - - onDestroy() { - console.log("[Demo] MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility2 onWindowStageCreate") - globalThis.ability3Context = this.context; - windowStage.setUIContent(this.context, "pages/MainAbility2_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility2 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility2 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts deleted file mode 100644 index f261521df699d8c0643bd274bb99f1a20178e6ce..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts +++ /dev/null @@ -1,132 +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 commonEvent from '@ohos.commonEvent'; -import Ability from '@ohos.application.Ability' - -export default class MainAbility3 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility3 onCreate") - globalThis.abilityWant = want; - - var getauxMainAbilityContext = { - events: ["auxMainAbilityContext"] - } - - - var a; - function SubscribeCallBackContext(err, data) { - console.log(" Subscribe CallBack data:" + JSON.stringify(data)); - a = data.parameters; - if(data.event != ""){ - for (var key in data.parameters){ - console.log("data.parameters[key] is :" + data.parameters[key]) - } - } - } - - commonEvent.createSubscriber(getauxMainAbilityContext).then(async (data) => { - console.debug("====>Create Subscriber====>"); - var Subscriber = data; - await commonEvent.subscribe(Subscriber, SubscribeCallBackContext); - }); - - var listKey = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityCreate") - listKey.push(abilityName +" onAbilityCreate"); - console.log("listKey is :" + listKey); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityWindowStageCreate") - listKey.push(abilityName +" onAbilityWindowStageCreate"); - console.log("listKey is :" + listKey); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityForeground") - listKey.push(abilityName +" onAbilityForeground"); - console.log("listKey is :" + listKey); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityBackground") - listKey.push(abilityName +" onAbilityBackground"); - console.log("listKey is :" + listKey); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityWindowStageDestroy") - listKey.push(abilityName +" onAbilityWindowStageDestroy"); - console.log("listKey is :" + listKey); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityDestroy") - listKey.push(abilityName +" onAbilityDestroy"); - console.log("listKey is :" + listKey); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName +" onAbilityContinue") - listKey.push(abilityName +" onAbilityContinue"); - console.log("listKey is :" + listKey); - } - } - - setTimeout(() => { - console.log("mainAbility3ListKey a is : " + JSON.stringify(a)) - //TODO: - var callBackId = a.auxMainAbilityContext.getApplicationContext(). - registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("mainAbility3ListKey callBackId is : " + callBackId) - globalThis.mainAbility3ListKey = listKey - console.log("mainAbility3ListKey mainAbility3ListKey is : " + globalThis.mainAbility3ListKey) - globalThis.mainAbility3CallBackId = callBackId - console.log("mainAbility3ListKey listKey is :" + listKey); - console.log("mainAbility3ListKey globalThis.callBackId is :" + globalThis.callBackId); - }, 3000) - - } - - onDestroy() { - console.log("[Demo] MainAbility3 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility3 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/MainAbility3_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility3 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility3 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility3 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts deleted file mode 100644 index 1135a535b6d884bb7a894a2bee439b0afe9743d8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts +++ /dev/null @@ -1,97 +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 Ability from '@ohos.application.Ability' - -export default class MainAbility4 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility4 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility4 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility4 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/MainAbility4_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility4 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility4 onForeground") - - var listKey = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityCreate") - listKey.push(abilityName+" onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityWindowStageCreate") - listKey.push(abilityName+" onAbilityWindowStageCreate"); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityForeground") - listKey.push(abilityName+" onAbilityForeground"); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityBackground") - listKey.push(abilityName+" onAbilityBackground"); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityWindowStageDestroy") - listKey.push(abilityName+" onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityDestroy") - listKey.push(abilityName+" onAbilityDestroy"); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityContinue") - listKey.push(abilityName+" onAbilityContinue"); - } - } - var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); - globalThis.abilityContext111 = this.context; - console.log("callBackId is aaa :" + callBackId); - setTimeout(() => { - globalThis.mainAbility4ListKey = listKey - globalThis.mainAbility4CallBackId = callBackId - console.log("listKey is :" + listKey); - console.log("callBackId is :" + callBackId); - }, 3000) - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility4 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts deleted file mode 100644 index b8b0fd6f13a89c5c79fa2feac583e7cffabf9557..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts +++ /dev/null @@ -1,104 +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 Ability from '@ohos.application.Ability' - -export default class MainAbility5 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility5 onCreate") - globalThis.abilityWant = want; - - var listKey = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityCreate") - listKey.push(abilityName+" onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityWindowStageCreate") - listKey.push(abilityName+" onAbilityWindowStageCreate"); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityForeground") - listKey.push(abilityName+" onAbilityForeground"); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityBackground") - listKey.push(abilityName+" onAbilityBackground"); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityWindowStageDestroy") - listKey.push(abilityName+" onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityDestroy") - listKey.push(abilityName+" onAbilityDestroy"); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityContinue") - listKey.push(abilityName+" onAbilityContinue"); - } - } - var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("callBackId is aaa :" + callBackId); - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap2MainAbility6 EventTest terminateSelf data: " + JSON.stringify(data)); - globalThis.mainAbility5ListKey = listKey - globalThis.mainAbility5CallBackId = callBackId - console.log("listKey is :" + listKey); - console.log("callBackId is :" + callBackId); - }).catch((error) => { - console.log("Hap2MainAbility6 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 1000) - } - - onDestroy() { - console.log("[Demo] MainAbility5 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility5 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/MainAbility5_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility5 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility5 onForeground") - - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility5 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts deleted file mode 100644 index 0c3363ca2d3f4684f73fbef049d3e4d7765c44a1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts +++ /dev/null @@ -1,97 +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 Ability from '@ohos.application.Ability' - -export default class MainAbility6 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility6 onCreate") - globalThis.abilityWant = want; - - var listKey = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityCreate") - listKey.push(abilityName+" onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityWindowStageCreate") - listKey.push(abilityName+" onAbilityWindowStageCreate"); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityForeground") - listKey.push(abilityName+" onAbilityForeground"); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityBackground") - listKey.push(abilityName+" onAbilityBackground"); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityWindowStageDestroy") - listKey.push(abilityName+" onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityDestroy") - listKey.push(abilityName+" onAbilityDestroy"); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName+" onAbilityContinue") - listKey.push(abilityName+" onAbilityContinue"); - } - } - var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("callBackId is aaa :" + callBackId); - setTimeout(() => { - globalThis.mainAbility6ListKey = listKey - globalThis.mainAbility6CallBackId = callBackId - console.log("listKey is :" + listKey); - console.log("callBackId is :" + callBackId); - }, 3000) - } - - onDestroy() { - console.log("[Demo] MainAbility6 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility6 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/MainAbility6_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility6 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility6 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility6 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets deleted file mode 100644 index 3a8db4687506587c36424a20c75dedf12c740f74..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets +++ /dev/null @@ -1,32 +0,0 @@ -// @ts-nocheck -/* - * 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. - */ -@Entry -@Component -struct MainAbility1_pages { - @State message: string = 'MainAbility1' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets deleted file mode 100644 index fb9275d616ea069045a605ee8fc1601fdd69239e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets +++ /dev/null @@ -1,32 +0,0 @@ -// @ts-nocheck -/* - * 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. - */ -@Entry -@Component -struct MainAbility2_pages { - @State message: string = 'MainAbility2' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets deleted file mode 100644 index 1a97c7c9ae71b175d2b85c801e11ccd094a81efa..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets +++ /dev/null @@ -1,31 +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. - */ -@Entry -@Component -struct MainAbility3_pages { - @State message: string = 'MainAbility3_pages' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets deleted file mode 100644 index e9515dbaeeb3d72905e4922dc869cb56371d9015..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets +++ /dev/null @@ -1,32 +0,0 @@ -// @ts-nocheck -/* - * 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. - */ -@Entry -@Component -struct MainAbility4_pages { - @State message: string = 'MainAbility4' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets deleted file mode 100644 index 9a196b1bf3d5f450c6a701b20a86e1595d6ff748..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets +++ /dev/null @@ -1,32 +0,0 @@ -// @ts-nocheck -/* - * 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. - */ -@Entry -@Component -struct MainAbility5_pages { - @State message: string = 'MainAbility5' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets deleted file mode 100644 index dde8ee882a42e26669a82bf10b2c3576f0da2d22..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets +++ /dev/null @@ -1,32 +0,0 @@ -// @ts-nocheck -/* - * 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. - */ -@Entry -@Component -struct MainAbility6_pages { - @State message: string = 'MainAbility6' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets deleted file mode 100644 index 27c527833617f8eb9f8a4dc32acce5988e4fdbf4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets +++ /dev/null @@ -1,57 +0,0 @@ -// @ts-nocheck -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" -import list from '../test/ListTest' - -@Entry -@Component -struct Index { - @State message: string = 'MainAbility' - - 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() - globalThis.abilityWant.parameters.timeout = 20000; - - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - configService.setConfig(globalThis.abilityWant.parameters) - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - list(globalThis.abilityContext) - core.execute() - } - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets deleted file mode 100644 index 7097cd62203155ca1d67c1d91eda6307a72e6a7b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets +++ /dev/null @@ -1,793 +0,0 @@ -// @ts-nocheck -/* - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" - -export default function abilityTest(abilityContext){ - - describe('AbilityTest', function() { - - console.info("-----------------LifecycleTest is start----------------") - - var TAG; - var listKeyTemp = []; - var listKeyTemp1 = []; - - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)) - } - - /* - * @tc.number Multihap_LifecycleTest_001 - * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_001", 0, async function (done) { - console.info("---------------Multihap_LifecycleTest_001 is start---------------") - TAG = "Multihap_LifecycleTest_001"; - listKeyTemp = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility3" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": Hap2MainAbility3 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { - if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility3") { - listKeyTemp.push(globalThis.mainAbility4ListKey[i]); - } - } - console.log(TAG + "listKeyTemp is :" + listKeyTemp); - console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility3 onAbilityCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility3 onAbilityWindowStageCreate"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility3 onAbilityForeground"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility3 onAbilityBackground"); - expect(listKeyTemp[4]).assertEqual("Hap2MainAbility3 onAbilityWindowStageDestroy"); - expect(listKeyTemp[5]).assertEqual("Hap2MainAbility3 onAbilityDestroy"); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 4000) - }); - console.info("---------------Multihap_LifecycleTest_001 is end---------------") - }); - - /* - * @tc.number Multihap_LifecycleTest_002 - * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (single instance) - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_002", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_002 start-------------"); - TAG = "Multihap_LifecycleTest_002"; - listKeyTemp = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility4" - }, (error, data) => { - console.log(TAG + ":first Hap2MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility4" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap2MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for(var i = 0; i { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 3000) - }); - console.log("------------Multihap_LifecycleTest_002 end-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_003 - * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (multiple cases) - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_003", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_003 start-------------"); - TAG = "Multihap_LifecycleTest_003"; - listKeyTemp = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility5" - }, (error, data) => { - console.log(TAG + ":first Hap2MainAbility5 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility5" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap2MainAbility5 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for(var i = 0;i { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 3000) - }); - console.log("------------Multihap_LifecycleTest_003 end-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_004 - * @tc.name The ability of HAP A monitors the ability life cycle callback of HAP B and HAP C - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_004", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_004 start-------------"); - TAG = "Multihap_LifecycleTest_004"; - listKeyTemp = []; - listKeyTemp1 = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility6" - }, (error, data) => { - console.log(TAG + ":first Hap2MainAbility6 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap3MainAbility2" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap3MainAbility2 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for(var i = 0;i { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 3000) - }); - console.log("------------Multihap_LifecycleTest_004 end-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_005 - * @tc.name The ability of HAP A listens to two ability life cycle callbacks in HAP B - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_005", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_005 start-------------"); - TAG = "Multihap_LifecycleTest_005"; - listKeyTemp = []; - listKeyTemp1 = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility6" - }, (error, data) => { - console.log(TAG + ":first Hap2MainAbility6 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility7" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap2MainAbility7 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for(var i = 0;i { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 3000) - }); - console.log("------------end Multihap_LifecycleTest_005-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_006 - * @tc.name Repeat the registration. The ability of HAP A listens to the life - cycle callback of the ability of HAP B - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_006", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_006 start-------------"); - TAG = "Multihap_LifecycleTest_006"; - listKeyTemp = []; - listKeyTemp1 = []; - var firstCallbackId; - var secondCallbackId; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": first MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility8" - }, (error, data) => { - setTimeout(function(){ - console.log(TAG + ": first Hap2MainAbility8 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log(TAG + "first globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - firstCallbackId = globalThis.mainAbility4CallBackId; - console.log(TAG + "firstCallbackId is : " + firstCallbackId); - }, 3000) - }); - - await sleep(1000); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": second MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility8" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap2MainAbility8 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for(var i = 0;i { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 3000) - }); - - console.log("------------Multihap_LifecycleTest_006 end-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_007 - * @tc.name Repeat registration and deregistration. The ability of HAP A listens to the life - cycle callback of the ability of HAP B - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_007", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_007 start-------------"); - TAG = "Multihap_LifecycleTest_007"; - listKeyTemp = []; - listKeyTemp1 = []; - var callBackId1; - var callBackId2; - var flag; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility6" - }, (error, data) => { - console.log(TAG + ": first MainAbility6 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - setTimeout(function(){ - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility9" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ":first Hap2MainAbility9 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - - for(var i = 0;i { - console.log(TAG + ": first unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - flag = error.code; - console.log(TAG + "flag is:" + flag); - }); - }, 3000) - }); - }, 1000) - - - setTimeout(function(){ - if(flag == 0){ - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility6" - }, (error, data) => { - console.log(TAG + ": first MainAbility6 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - setTimeout(function(){ - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility9" - }, (error, data) => { - - setTimeout(() => { - console.log(TAG + ":second Hap2MainAbility9 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - - for(var i = 0;i { - console.log(TAG + ": second unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 3000) - }) - }, 2000) - } - }, 10000) - - console.log("------------Multihap_LifecycleTest_007 end-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_008 - * @tc.name Repeat deregistration. The ability of HAP A listens to the life - cycle callback of the ability of HAP B - * @tc.desc Function test - * @tc.level 0 - */ - it("Multihap_LifecycleTest_008", 0, async function (done) { - console.log("------------Multihap_LifecycleTest_008 start-------------"); - TAG = "Multihap_LifecycleTest_008"; - listKeyTemp = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4" - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility6" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": Hap2MainAbility6 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - - for(var i = 0;i { - console.log(TAG + ": first unregisterAbilityLifecycleCallback, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue; - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { - console.log(TAG + ": second unregisterAbilityLifecycleCallback, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue; - done() - }); - }); - }, 4000) - }); - console.log("------------Multihap_LifecycleTest_008 end-------------"); - }); - - /* - * @tc.number Multihap_LifecycleTest_010 - * @tc.name Switch the front and background for many times to monitor the life cycle - * @tc.desc Function test - * @tc.level 0 - */ - it('Multihap_LifecycleTest_010', 0, async function (done) { - console.info("---------------Multihap_LifecycleTest_010 is start---------------") - TAG = "Multihap_LifecycleTest_010"; - listKeyTemp = []; - listKeyTemp1 = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility4", - }, (error, data) => { - console.log(TAG + ": MainAbility4 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - await sleep(1000) - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility10", - }, (error, data) => { - console.log(TAG + ": first Hap2MainAbility10 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - await sleep(1000) - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap3MainAbility3", - }, (error, data) => { - console.log(TAG + ": first Hap3MainAbility3 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - await sleep(1000) - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility10", - }, (error, data) => { - console.log(TAG + ": second Hap2MainAbility10 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - await sleep(1000) - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap3MainAbility3", - }, (error, data) => { - console.log(TAG + ": second Hap3MainAbility3 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - - await sleep(1000) - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap2MainAbility10", - }, (error, data) => { - console.log(TAG + ": third Hap2MainAbility10 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - await sleep(1000) - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap3MainAbility3", - }, (error, data) => { - - setTimeout(() => { - console.log(TAG + ": third Hap3MainAbility3 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - - for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { - if (globalThis.mainAbility4ListKey[i].substring(0, 17) == "Hap2MainAbility10") { - listKeyTemp.push(globalThis.mainAbility4ListKey[i]); - }else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap3MainAbility3") { - listKeyTemp1.push(globalThis.mainAbility4ListKey[i]); - } - } - console.log(TAG + " listKeyTemp is :" + listKeyTemp); - console.log(TAG + " listKeyTemp1 is :" + listKeyTemp1); - console.log(TAG + " globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility10 onAbilityCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility10 onAbilityWindowStageCreate"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility10 onAbilityForeground"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility10 onAbilityBackground"); - expect(listKeyTemp[4]).assertEqual("Hap2MainAbility10 onAbilityForeground"); - expect(listKeyTemp[5]).assertEqual("Hap2MainAbility10 onAbilityBackground"); - expect(listKeyTemp[6]).assertEqual("Hap2MainAbility10 onAbilityForeground"); - expect(listKeyTemp[7]).assertEqual("Hap2MainAbility10 onAbilityBackground"); - - expect(listKeyTemp1[0]).assertEqual("Hap3MainAbility3 onAbilityCreate"); - expect(listKeyTemp1[1]).assertEqual("Hap3MainAbility3 onAbilityWindowStageCreate"); - expect(listKeyTemp1[2]).assertEqual("Hap3MainAbility3 onAbilityForeground"); - expect(listKeyTemp1[3]).assertEqual("Hap3MainAbility3 onAbilityBackground"); - expect(listKeyTemp1[4]).assertEqual("Hap3MainAbility3 onAbilityForeground"); - expect(listKeyTemp1[5]).assertEqual("Hap3MainAbility3 onAbilityBackground"); - expect(listKeyTemp1[6]).assertEqual("Hap3MainAbility3 onAbilityForeground"); - - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 4000) - }) - console.info("---------------Multihap_LifecycleTest_010 is end---------------") - }) - - /* - * @tc.number Multihap_LifecycleTest_011 - * @tc.name The ability of HAP A listens to the life cycle callback - of the ability of HAP B in different processes - * @tc.desc Function test - * @tc.level 0 - */ - it('Multihap_LifecycleTest_011', 0, async function (done) { - console.info("---------------Multihap_LifecycleTest_011 is start---------------") - TAG = "Multihap_LifecycleTest_011"; - listKeyTemp = []; - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "MainAbility2", - }, (error, data) => { - console.log(TAG + ": Hap1MainAbility2 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - }) - - await sleep(500); - - abilityContext.startAbility({ - bundleName: "com.example.lifecycletest", - abilityName: "Hap4MainAbility1", - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": Hap4MainAbility1 startAbility success, err: " + - JSON.stringify(error) + ",data: " + JSON.stringify(data)); - - for (var i = 0; i < globalThis.mainAbility2ListKey.length; i++) { - if (globalThis.mainAbility2ListKey[i].substring(0, 16) == "Hap4MainAbility1") { - listKeyTemp.push(globalThis.mainAbility2ListKey[i]); - } - } - console.log(TAG + " listKeyTemp is :" + listKeyTemp); - console.log(TAG + " globalThis.mainAbility2CallBackId is :" + globalThis.mainAbility2CallBackId); - expect(listKeyTemp.length == 0).assertTrue(); - - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.mainAbility2CallBackId, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - expect(error.code == 0).assertTrue() - done(); - }); - }, 4000) - }); - console.info("---------------Multihap_LifecycleTest_011 is end---------------") - }) - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets deleted file mode 100644 index 73ff567c41ab8bef5c456b4ac88d599e0cbca2ae..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.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 lifecycleTest from './LifecycleTest' - -export default function List(context) { - - lifecycleTest(context) - -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/module.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/module.json deleted file mode 100644 index a3a8239e35107c50552ba68a80ac69c2d64f1302..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/module.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [{ - "name": "com.example.lifecycletest.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" - ] - }] - }, - { - "name": "MainAbility1", - "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", - "description": "$string:MainAbility1_desc", - "icon": "$media:icon", - "label": "$string:MainAbility1_label" - }, - { - "name": "MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", - "description": "$string:MainAbility2_desc", - "icon": "$media:icon", - "label": "$string:MainAbility2_label" - }, - { - "name": "MainAbility3", - "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", - "description": "$string:MainAbility3_desc", - "icon": "$media:icon", - "label": "$string:MainAbility3_label" - }, - { - "name": "MainAbility4", - "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", - "description": "$string:MainAbility4_desc", - "icon": "$media:icon", - "label": "$string:MainAbility4_label" - }, - { - "name": "MainAbility5", - "srcEntrance": "./ets/MainAbility5/MainAbility5.ts", - "description": "$string:MainAbility5_desc", - "icon": "$media:icon", - "label": "$string:MainAbility5_label" - }, - { - "name": "MainAbility6", - "srcEntrance": "./ets/MainAbility6/MainAbility6.ts", - "description": "$string:MainAbility6_desc", - "icon": "$media:icon", - "label": "$string:MainAbility6_label", - "launchType": "standard" - }], - "requestPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.MANAGE_MISSIONS" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 95c6e384d76eb665a80a3bce9603d5a3a8960dbd..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,84 +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": "ActsLifecycleMultihapTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "MainAbility1_desc", - "value": "description" - }, - { - "name": "MainAbility1_label", - "value": "label" - }, - { - "name": "MainAbility2_desc", - "value": "description" - }, - { - "name": "MainAbility2_label", - "value": "label" - }, - { - "name": "MainAbility3_desc", - "value": "description" - }, - { - "name": "MainAbility3_label", - "value": "label" - }, - { - "name": "MainAbility4_desc", - "value": "description" - }, - { - "name": "MainAbility4_label", - "value": "label" - }, - { - "name": "MainAbility5_desc", - "value": "description" - }, - { - "name": "MainAbility5_label", - "value": "label" - }, - { - "name": "MainAbility6_desc", - "value": "description" - }, - { - "name": "MainAbility6_label", - "value": "label" - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts deleted file mode 100644 index b61df6a987ba961de7550742325d73c589662d97..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts +++ /dev/null @@ -1,57 +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 Ability from '@ohos.application.Ability' - -export default class Hap4MainAbility1 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap4MainAbility1 onCreate") - globalThis.abilityWant = want; - - setTimeout(()=>{ - this.context.terminateSelf().then((data) => { - console.log("[Demo] Hap4MainAbility1 terminateSelf windowStage data: " + JSON.stringify(data)) - }).catch((error) => { - console.log("[Demo] Hap4MainAbility1 terminateSelf windowStage error: " + JSON.stringify(error)) - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap4MainAbility1 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap4MainAbility1 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/Hap4MainAbility1_pages", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap4MainAbility1 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap4MainAbility1 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap4MainAbility1 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets deleted file mode 100644 index d523a89b78863cbecbbb5cf52b6c34ca35daa843..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets +++ /dev/null @@ -1,32 +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. - */ - -@Entry -@Component -struct Index { - @State message: string = 'Hap4MainAbility1' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/module.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/module.json deleted file mode 100644 index 60e88e4d49c1f0fe54d7aca2bf2aa517c8589d66..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/module.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "module": { - "name": "hap4", - "type": "feature", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:hap4_desc", - "mainElement": "Hap4MainAbility1", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "process": "hap4mainability", - "pages": "$profile:main_pages", - "abilities": [{ - "name": "com.example.lifecycletest.hap4mainability", - "srcEntrance": "./ets/hap4mainability/hap4mainability.ts", - "description": "$string:Hap4MainAbility1_desc", - "icon": "$media:icon", - "label": "$string:Hap4MainAbility1_label", - "visible": true, - "orientation": "portrait", - "skills": [{ - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - }] - }], - "requestPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.MANAGE_MISSIONS" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" - } - ] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/element/string.json deleted file mode 100644 index 0197573a46ad0a7c3ee2491111ac365a538f87ed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/element/string.json +++ /dev/null @@ -1,48 +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": "ActsLifecycleMultihapTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "hap4_desc", - "value": "description" - }, - { - "name": "Hap4MainAbility1_desc", - "value": "description" - }, - { - "name": "Hap4MainAbility1_label", - "value": "label" - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/app.json b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/app.json deleted file mode 100644 index 7ec3b9c3016df3553d01382255a242626b12726c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.lifecycle_xts", - "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 - } - } -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/resources/base/element/string.json deleted file mode 100644 index 11b4c6b43d17c7dfc2ecb1ca89f57966cb09658d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"LifeCycle_XTS" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/BUILD.gn b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/BUILD.gn deleted file mode 100644 index c45f0a26fb39471964942f7291d4a17d2e75099e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/BUILD.gn +++ /dev/null @@ -1,40 +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("ActsLifecycleSingleHapTest") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":actslifecyclesinglehaptest_js_assets", - ":actslifecyclesinglehaptest_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsLifecycleSingleHapTest" -} - -ohos_app_scope("actslifecyclesinglehaptest_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("actslifecyclesinglehaptest_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("actslifecyclesinglehaptest_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":actslifecyclesinglehaptest_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/Test.json b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/Test.json deleted file mode 100644 index 908e1c8be068a92aec81cf3649ef6398f156c532..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.example.lifecycle_xts", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsLifecycleSingleHapTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility1/Hap1MainAbility1.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility1/Hap1MainAbility1.ts deleted file mode 100644 index 3a646a2a07ff0aeef45113c758ba53f5f92f2cac..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility1/Hap1MainAbility1.ts +++ /dev/null @@ -1,55 +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 Hap1MainAbility1 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap1MainAbility1 onCreate") - globalThis.abilityWant = want; - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap1MainAbility1 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap1MainAbility1 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap1MainAbility1 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap1MainAbility1 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/indexh1a1", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap1MainAbility1 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap1MainAbility1 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap1MainAbility1 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility2/Hap1MainAbility2.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility2/Hap1MainAbility2.ts deleted file mode 100644 index 2e58304b99f2304d3e44bfe3ce1cf4b861c88295..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility2/Hap1MainAbility2.ts +++ /dev/null @@ -1,56 +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 Hap1MainAbility2 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] Hap1MainAbility2 onCreate") - globalThis.abilityWant = want; - - setTimeout(() => { - this.context.terminateSelf().then((data) => { - console.log("Hap1MainAbility2 EventTest terminateSelf data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("Hap1MainAbility2 EventTest terminateSelf error: " + JSON.stringify(error)); - }) - }, 2000) - } - - onDestroy() { - console.log("[Demo] Hap1MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] Hap1MainAbility2 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/indexh1a2", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] Hap1MainAbility2 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] Hap1MainAbility2 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] Hap1MainAbility2 onBackground") - } -}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 5986ef5a73750dc2ef8511ad08f607bbb706468d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,48 +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) { - console.log("[Demo] MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context; - windowStage.setUIContent(this.context, "pages/index", 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") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts deleted file mode 100644 index 3f553e2128643a4fb89f417bbc91be1b39ce7723..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts +++ /dev/null @@ -1,131 +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 MainAbility1 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility1 onCreate") - globalThis.abilityWant = want; - console.log("[Demo] MainAbility1 context: " + JSON.stringify(this.context)); - var listKey1 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey1.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey1:" + JSON.stringify(listKey1)); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey1.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey1:" + JSON.stringify(listKey1)); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey1.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey1:" + JSON.stringify(listKey1)); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey1.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey1:" + JSON.stringify(listKey1)); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey1.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey1:" + JSON.stringify(listKey1)); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey1.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey1:" + JSON.stringify(listKey1)); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback1 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback1 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey1.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey1:" + JSON.stringify(listKey1)); - } - } - let applicationContext = this.context.getApplicationContext(); - console.log("[Demo] MainAbility1 applicationContext: " + JSON.stringify(applicationContext)); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback1 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback1 listKey: " + JSON.stringify(listKey1)); - globalThis.list1 = listKey1; - globalThis.callbackid1 = lifecycleid; - }, 2500); - } - - onDestroy() { - console.log("[Demo] MainAbility1 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility1 onWindowStageCreate") - globalThis.ability1context = this.context; - windowStage.setUIContent(this.context, "pages/index1", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility1 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility1 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility1 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts deleted file mode 100644 index 6b74bd33334ae9c7c980be2d393d27bce5802279..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts +++ /dev/null @@ -1,116 +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 MainAbility10 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility10 onCreate") - globalThis.abilityWant = want; - var listKey10 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey10.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey10:" + JSON.stringify(listKey10)); - }, - onAbilityWindowStageCreate(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey10.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey10:" + JSON.stringify(listKey10)); - }, - onAbilityWindowStageDestroy(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey10.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey10:" + JSON.stringify(listKey10)); - }, - onAbilityDestroy(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey10.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey10:" + JSON.stringify(listKey10)); - }, - onAbilityForeground(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey10.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey10:" + JSON.stringify(listKey10)); - }, - onAbilityBackground(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey10.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey10:" + JSON.stringify(listKey10)); - }, - onAbilityContinue(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback10 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey10.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey10:" + JSON.stringify(listKey10)); - } - } - let applicationContext = this.context.getApplicationContext(); - console.log("[Demo] MainAbility10 applicationContext: " + JSON.stringify(applicationContext)); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback10 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback10 listKey: " + JSON.stringify(listKey10)); - globalThis.list10 = listKey10; - globalThis.callbackid10 = lifecycleid; - }, 1500); - } - - onDestroy() { - console.log("[Demo] MainAbility10 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility10 onWindowStageCreate") - globalThis.ability10 = this.context; - windowStage.setUIContent(this.context, "pages/index10", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility10 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility10 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility10 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts deleted file mode 100644 index 4214c6f15811cd3eddb55b917e2dff719ca2baa1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts +++ /dev/null @@ -1,110 +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 MainAbility11 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility11 onCreate") - globalThis.abilityWant = want; - globalThis.ability11 = this.context; - var listKey11 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey11.push(abilityname + " onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey11.push(abilityname + " onAbilityWindowStageCreate"); - }, - onAbilityWindowStageDestroy(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey11.push(abilityname + " onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey11.push(abilityname + " onAbilityDestroy"); - }, - onAbilityForeground(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey11.push(abilityname + " onAbilityForeground"); - }, - onAbilityBackground(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey11.push(abilityname + " onAbilityBackground"); - }, - onAbilityContinue(ability) { - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback11 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey11.push(abilityname + " onAbilityContinue"); - } - } - let applicationContext = globalThis.ability11.getApplicationContext(); - console.log("[Demo] MainAbility11 applicationContext: " + JSON.stringify(applicationContext)); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback11 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback11 listKey: " + JSON.stringify(listKey11)); - globalThis.list11 = listKey11; - globalThis.callbackid11 = lifecycleid; - }, 2000); - } - - onDestroy() { - console.log("[Demo] MainAbility11 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility11 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/index11", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility11 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility11 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts deleted file mode 100644 index fef3107e3bc4fbbb1fea697fa62b284e4c2f08a6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts +++ /dev/null @@ -1,109 +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 MainAbility12 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility12 onCreate") - globalThis.abilityWant = want; - var listKey12 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey12.push(abilityname + " onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey12.push(abilityname + " onAbilityWindowStageCreate"); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey12.push(abilityname + " onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey12.push(abilityname + " onAbilityDestroy"); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey12.push(abilityname + " onAbilityForeground"); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey12.push(abilityname + " onAbilityBackground"); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback12 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey12.push(abilityname + " onAbilityContinue"); - } - } - let applicationContext = this.context.getApplicationContext(); - console.log("[Demo] MainAbility12 applicationContext: " + JSON.stringify(applicationContext)); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback12 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback12 listKey: " + JSON.stringify(listKey12)); - globalThis.list12 = listKey12; - globalThis.callbackid12 = lifecycleid; - }, 1700); - } - - onDestroy() { - console.log("[Demo] MainAbility12 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility12 onWindowStageCreate") - globalThis.ability12 = this.context; - windowStage.setUIContent(this.context, "pages/index12", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility12 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility12 onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility12 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts deleted file mode 100644 index a4853c8d79efd4b266d45afda66fbc9bfcc6d222..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ /dev/null @@ -1,56 +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 MainAbility2 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility2 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility2 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility2 onWindowStageCreate") - globalThis.ability2 = this.context; - windowStage.setUIContent(this.context, "pages/index2", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility2 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility2 onForeground") - setTimeout(function () { - globalThis.ability2.terminateSelf() - .then((data) => { - console.info('[Demo] MainAbility2 terminateself succeeded: ' + data); - }).catch((error) => { - console.error('[Demo] MainAbility2 terminateself failed. Cause: ' + error); - }) - }, 500); - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility2 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts deleted file mode 100644 index 24f4ffb255e7f7d4a97e26bc3ad881cf56938b8f..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts +++ /dev/null @@ -1,132 +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 MainAbility3 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility3 onCreate") - globalThis.abilityWant = want; - - console.log("[Demo] MainAbility3 context: " + JSON.stringify(this.context)); - var listKey3 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey3.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey3:" + JSON.stringify(listKey3)); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey3.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey3:" + JSON.stringify(listKey3)); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey3.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey3:" + JSON.stringify(listKey3)); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey3.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey3:" + JSON.stringify(listKey3)); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey3.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey3:" + JSON.stringify(listKey3)); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey3.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey3:" + JSON.stringify(listKey3)); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback3 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback3 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey3.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey3:" + JSON.stringify(listKey3)); - } - } - let applicationContext = this.context.getApplicationContext(); - console.log("[Demo] MainAbility3 applicationContext: " + JSON.stringify(applicationContext)); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback3 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback3 listKey : " + JSON.stringify(listKey3)); - globalThis.list3 = listKey3; - globalThis.callbackid3 = lifecycleid; - }, 2000); - } - - onDestroy() { - console.log("[Demo] MainAbility3 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility3 onWindowStageCreate") - globalThis.ability3 = this.context - windowStage.setUIContent(this.context, "pages/index3", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility3 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts deleted file mode 100644 index 44eb81e3ab2cfcfe2417633f6daab018712d8316..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts +++ /dev/null @@ -1,140 +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 MainAbility4 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility4 onCreate") - globalThis.abilityWant = want; - - console.log("[Demo] MainAbility4 context: " + JSON.stringify(this.context)); - var listKey4 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey4.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey4:" + JSON.stringify(listKey4)); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey4.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey4:" + JSON.stringify(listKey4)); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey4.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey4:" + JSON.stringify(listKey4)); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey4.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey4:" + JSON.stringify(listKey4)); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey4.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey4:" + JSON.stringify(listKey4)); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey4.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey4:" + JSON.stringify(listKey4)); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback4 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback4 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey4.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey4:" + JSON.stringify(listKey4)); - } - } - let applicationContext = this.context.getApplicationContext(); - console.log("[Demo] MainAbility4 applicationContext: " + JSON.stringify(applicationContext)); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback4 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback4 listKey : " + JSON.stringify(listKey4)); - globalThis.list4 = listKey4; - globalThis.callbackid4 = lifecycleid; - }, 1500); - } - - onDestroy() { - console.log("[Demo] MainAbility4 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility4 onWindowStageCreate") - globalThis.ability4 = this.context; - windowStage.setUIContent(this.context, "pages/index4", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility4 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility4 onForeground") - setTimeout(function () { - globalThis.ability4.terminateSelf() - .then((data) => { - console.info('[Demo] MainAbility4 terminateself succeeded: ' + data); - }).catch((error) => { - console.error('[Demo] MainAbility4 terminateself failed. Cause: ' + error); - }) - }, 5000); - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility4 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts deleted file mode 100644 index 31f8bd19551b9c4d1b57c45cf103a76c337e5dcc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts +++ /dev/null @@ -1,56 +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 MainAbility5 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility5 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility5 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility5 onWindowStageCreate") - globalThis.ability5 = this.context; - windowStage.setUIContent(this.context, "pages/index5", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility5 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility5 onForeground") - setTimeout(function () { - globalThis.ability5.terminateSelf() - .then((data) => { - console.info('[Demo] MainAbility5 terminateself succeeded: ' + data); - }).catch((error) => { - console.error('[Demo] MainAbility5 terminateself failed. Cause: ' + error); - }) - }, 500); - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility5 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts deleted file mode 100644 index 444da364fc65615ef1b5d75cad97a8bf73e1c721..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts +++ /dev/null @@ -1,130 +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 MainAbility6 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility6 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility6 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility6 onWindowStageCreate") - globalThis.ability6 = this.context; - windowStage.setUIContent(this.context, "pages/index6", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility6 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility6 onForeground") - - var listKey6 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey6.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey6:" + JSON.stringify(listKey6)); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey6.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey6:" + JSON.stringify(listKey6)); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey6.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey6:" + JSON.stringify(listKey6)); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey6.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey6:" + JSON.stringify(listKey6)); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey6.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey6:" + JSON.stringify(listKey6)); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey6.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey6:" + JSON.stringify(listKey6)); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback6 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback6 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey6.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey6:" + JSON.stringify(listKey6)); - } - } - let applicationContext = globalThis.ability6.getApplicationContext(); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] registerAbilityLifecycleCallback6 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] registerAbilityLifecycleCallback6 listKey: " + JSON.stringify(listKey6)); - globalThis.list6 = listKey6; - globalThis.callbackid6 = lifecycleid; - }, 1500); - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility6 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts deleted file mode 100644 index 50a57d98442d8a077f168c5f54d04b445994d1a9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts +++ /dev/null @@ -1,130 +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 MainAbility7 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility7 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility7 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility7 onWindowStageCreate") - globalThis.ability7 = this.context; - windowStage.setUIContent(this.context, "pages/index7", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility7 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility7 onForeground") - - var listKey7 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey7.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey7:" + JSON.stringify(listKey7)); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey7.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey7:" + JSON.stringify(listKey7)); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey7.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey7:" + JSON.stringify(listKey7)); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey7.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey7:" + JSON.stringify(listKey7)); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey7.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey7:" + JSON.stringify(listKey7)); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey7.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey7:" + JSON.stringify(listKey7)); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback7 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback7 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey7.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey7:" + JSON.stringify(listKey7)); - } - } - let applicationContext = this.context.getApplicationContext(); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] AbilityLifecycleCallback7 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] AbilityLifecycleCallback7 listKey: " + JSON.stringify(listKey7)); - globalThis.list7 = listKey7; - globalThis.callbackid7 = lifecycleid; - }, 1500); - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility7 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts deleted file mode 100644 index 3bd583fa7d9de138fcb74bc9c6099d783054c5e3..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts +++ /dev/null @@ -1,130 +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 MainAbility8 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility8 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility8 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility8 onWindowStageCreate") - globalThis.ability8 = this.context; - windowStage.setUIContent(this.context, "pages/index8", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility8 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility8 onForeground") - var listKey8 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityCreate"); - listKey8.push(abilityname + " onAbilityCreate"); - console.log("[Demo] 1listKey8:" + JSON.stringify(listKey8)); - }, - onAbilityWindowStageCreate(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageCreate ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageCreate abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); - listKey8.push(abilityname + " onAbilityWindowStageCreate"); - console.log("[Demo] 2listKey8:" + JSON.stringify(listKey8)); - }, - onAbilityWindowStageDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); - listKey8.push(abilityname + " onAbilityWindowStageDestroy"); - console.log("[Demo] 3listKey8:" + JSON.stringify(listKey8)); - }, - onAbilityDestroy(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityDestroy"); - listKey8.push(abilityname + " onAbilityDestroy"); - console.log("[Demo] 4listKey8:" + JSON.stringify(listKey8)); - }, - onAbilityForeground(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityForeground"); - listKey8.push(abilityname + " onAbilityForeground"); - console.log("[Demo] 5listKey8:" + JSON.stringify(listKey8)); - }, - onAbilityBackground(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityBackground"); - listKey8.push(abilityname + " onAbilityBackground"); - console.log("[Demo] 6listKey8:" + JSON.stringify(listKey8)); - }, - onAbilityContinue(ability) { - console.log("[Demo] AbilityLifecycleCallback8 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log("[Demo] AbilityLifecycleCallback8 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log("[Demo] " + abilityname + " onAbilityContinue"); - listKey8.push(abilityname + " onAbilityContinue"); - console.log("[Demo] 7listKey8:" + JSON.stringify(listKey8)); - } - } - let applicationContext = this.context.getApplicationContext(); - let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("[Demo] AbilityLifecycleCallback8 number: " + JSON.stringify(lifecycleid)); - setTimeout(function () { - console.log("[Demo] AbilityLifecycleCallback8 listKey: " + JSON.stringify(listKey8)); - globalThis.list8 = listKey8; - globalThis.callbackid8 = lifecycleid; - }, 1500); - - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility8 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts deleted file mode 100644 index 1d1223b749fb6eed9f5f15919a66ad588ac3137e..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts +++ /dev/null @@ -1,98 +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 MainAbility9 extends Ability { - onCreate(want, launchParam) { - console.log("[Demo] MainAbility9 onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - console.log("[Demo] MainAbility9 onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility9 onWindowStageCreate") - - windowStage.setUIContent(this.context, "pages/index9", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility9 onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility9 onForeground") - - var listKey9 = []; - var abilityName = ""; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityCreate") - listKey9.push(abilityName + " onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityWindowStageCreate") - listKey9.push(abilityName + " onAbilityWindowStageCreate"); - }, - onAbilityForeground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityForeground") - listKey9.push(abilityName + " onAbilityForeground"); - }, - onAbilityBackground(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityBackground") - listKey9.push(abilityName + " onAbilityBackground"); - }, - onAbilityWindowStageDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityWindowStageDestroy") - listKey9.push(abilityName + " onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityDestroy") - listKey9.push(abilityName + " onAbilityDestroy"); - }, - onAbilityContinue(ability) { - abilityName = ability.context.abilityInfo.name; - console.log(abilityName + " onAbilityContinue") - listKey9.push(abilityName + " onAbilityContinue"); - } - } - var callBackId = this.context.getApplicationContext() - .registerAbilityLifecycleCallback(AbilityLifecycleCallback); - - console.log("callBackId is aaa :" + callBackId); - setTimeout(() => { - globalThis.mainAbility9ListKey = listKey9 - globalThis.mainAbility9CallBackId = callBackId - console.log("listKey is :" + listKey9); - console.log("callBackId is :" + callBackId); - }, 3000) - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility9 onBackground") - } -}; diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index.ets deleted file mode 100644 index 6b8308de4f5ff4638fc2cba8ecb530d390f24b9a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index.ets +++ /dev/null @@ -1,55 +0,0 @@ -// @ts-nocheck -/* - * 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" -import List from '../test/ListTest' - -@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() - globalThis.abilityWant.parameters.timeout = 10000; - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - configService.setConfig(globalThis.abilityWant.parameters); - List(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index1.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index1.ets deleted file mode 100644 index 40c9dff117561e40676f785d2c77aa10a08c6bed..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index1.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index1 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability1') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index10.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index10.ets deleted file mode 100644 index db3c738e75a8619d39f9d77a609c1e4e3dd01f06..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index10.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index10 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability10') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index11.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index11.ets deleted file mode 100644 index 755c6891d6a3a6e73a2856182a931cefb82fb405..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index11.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index11 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability11') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index12.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index12.ets deleted file mode 100644 index cec620290d133591a83762ed40461a5ba2494bd1..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index12.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index12 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability12') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index2.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index2.ets deleted file mode 100644 index a79da622fa0a22e15bb28f16b563bc753a2dae6b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index2.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index2 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability2') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index3.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index3.ets deleted file mode 100644 index 28fada20fc3f8485d5b29670e2ad699b6fe4057b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index3.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index3 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability3') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index4.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index4.ets deleted file mode 100644 index e8504c939884f6503cfdf9a8f86fc8aa40be403d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index4.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index4 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability4') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index5.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index5.ets deleted file mode 100644 index 09efb81e93bb7c9c447775bc47441e239a830cb4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index5.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index5 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability5') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index6.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index6.ets deleted file mode 100644 index 3408617774f81bd00890204b67abe4688a7c268d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index6.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index6 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability6') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index7.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index7.ets deleted file mode 100644 index bb3c50427c96958d2cfe12e9cd19efb1a852a856..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index7.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index7 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability7') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index8.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index8.ets deleted file mode 100644 index 990eeceaa168ce18fa5e6b7af3082184704cd3aa..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index8.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index8 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability8') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index9.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index9.ets deleted file mode 100644 index c2ec1c984f944665fecde13e1e11ac4b753ecddf..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index9.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct Index9 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Mainability9') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a1.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a1.ets deleted file mode 100644 index bf7d34040466009423ce902a9c13005d9a44d984..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a1.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct indexh1a1 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Hap1MainAbility1') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a2.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a2.ets deleted file mode 100644 index dc058ea9b374816c290fd5c4330740df051e0eb9..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a2.ets +++ /dev/null @@ -1,27 +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. - */ -@Entry -@Component -struct indexh1a2 { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World Hap1MainAbility2') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets deleted file mode 100644 index f6100edf770b988d0932b0d0e54b579a10458c1d..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets +++ /dev/null @@ -1,1593 +0,0 @@ -// @ts-nocheck -/* - * 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 "deccjsunit/index" - -export default function lifecycleTest(abilityContext) { - describe('LifeCycleTest', function () { - - beforeEach(async function (done) { - console.info('LifeCycleTest before each called'); - await sleep(1000); - done() - }); - - afterEach(async function (done) { - console.info('LifeCycleTest after each called'); - if ("Singlehap_LifeCycleTest_0200" === TAG || "Singlehap_LifeCycleTest_0300" === TAG - || "Singlehap_LifeCycleTest_0500" === TAG || "Singlehap_LifeCycleTest_0600" === TAG - || "Singlehap_LifeCycleTest_0800" === TAG || "Singlehap_LifeCycleTest_0900" === TAG) { - var para = { - resultCode: 2, - want: { - "abilityName": "MainAbility1", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log("LifeCycleTest terminateSelfwithresult para: " + JSON.stringify(para)); - await globalThis.ability1context.terminateSelfWithResult(para) - .then((data) => { - console.log("LifeCycleTest terminateSelfwithresult successful data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("LifeCycleTest terminateSelfwithresult error: " + JSON.stringify(error)); - }); - } else if ("Singlehap_LifeCycleTest_2000" === TAG) { - var para1 = { - resultCode: 2, - want: { - "abilityName": "MainAbility12", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log("LifeCycleTest terminateSelfwithresult para: " + JSON.stringify(para1)); - await globalThis.ability12.terminateSelfWithResult(para1) - .then((data) => { - console.log("LifeCycleTest terminateSelfwithresult successful data: " + JSON.stringify(data)); - }).catch((error) => { - console.log("LifeCycleTest terminateSelfwithresult error: " + JSON.stringify(error)); - }); - } - done(); - }); - - var TAG = ""; - var listKeyTemp = "" - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)) - } - /* - * @tc.number Singlehap_LifeCycleTest_0100 - * @tc.name Register in abilitystage,listen to the lifecycle of abilityA,deregister after listening - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0100", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0100 START-------------"); - TAG = "Singlehap_LifeCycleTest_0100"; - var code; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list)); - console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list.length; i++) { - strtemp = globalThis.list[i].substring(0, 12); - if (strtemp === "MainAbility2") { - listtemp.push(globalThis.list[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - globalThis.abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - }); - setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(code).assertEqual(0); - console.log("------------Singlehap_LifeCycleTest_0100 END-------------"); - done(); - }, 1000); - }, 3000); - }) - - /* - * @tc.number Singlehap_LifeCycleTest_0200 - * @tc.name Register in abilityA,listen to the lifecycle of abilityB,deregister after listening - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0200", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0200 START-------------"); - TAG = "Singlehap_LifeCycleTest_0200"; - var code; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); - var list = globalThis.list1 - console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list1.length; i++) { - strtemp = globalThis.list1[i].substring(0, 12); - if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { - listtemp.push(globalThis.list1[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - }) - setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); - expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(code).assertEqual(0); - console.log("------------Singlehap_LifeCycleTest_0200 END-------------"); - done(); - }, 1000); - }, 3000); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0300 - * @tc.name Register in abilityA,listening the lifecycle of abilityB,deregister,repeat the unregister - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0300", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0300 START-------------"); - TAG = "Singlehap_LifeCycleTest_0300"; - var code; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); - console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list1.length; i++) { - strtemp = globalThis.list1[i].substring(0, 12); - if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { - listtemp.push(globalThis.list1[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1) - .then((data) => { - console.info(TAG + ' unregisterAbilityLifecycleCallback successful. Data: ' + data); - }) - .catch((error) => { - console.error(TAG + ' unregisterAbilityLifecycleCallback failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - console.log(TAG + " secondunregister callbackid : " + JSON.stringify(globalThis.callbackid1)); - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback_1 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - }) - }, 500); - setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); - expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(code).assertEqual(1); - console.log("------------Singlehap_LifeCycleTest_0300 END-------------"); - done(); - }, 2000); - }, 3000); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0400 - * @tc.name Register in abilityA,listening the lifecycle of abilityB,terminate abilityA,unregister - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0400", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0400 START-------------"); - TAG = "Singlehap_LifeCycleTest_0400"; - var code; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility3", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start3 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start3 failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start2 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start2 failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list3)); - console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid3)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list3.length; i++) { - strtemp = globalThis.list3[i].substring(0, 12); - if (strtemp === "MainAbility3" || strtemp === "MainAbility2") { - listtemp.push(globalThis.list3[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - var para = { - resultCode: 1, - want: { - "abilityName": "MainAbility3", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); - globalThis.ability3.terminateSelfWithResult(para) - .then((data) => { - console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); - }); - setTimeout(function () { - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid3, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback3 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - }) - }, 500); - setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility3 onAbilityWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility3 onAbilityForeground"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[5]).assertEqual("MainAbility3 onAbilityBackground"); - expect(exlist[6]).assertEqual("MainAbility3 onAbilityForeground"); - expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(code).assertEqual(0); - console.log("------------Singlehap_LifeCycleTest_0400 END-------------"); - done(); - }, 1000); - }, 3000); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0500 - * @tc.name Register in abilityA and abilityB,unregister MainabilityB,then Register in ManinabilityC - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0500", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0500 START-------------"); - TAG = "Singlehap_LifeCycleTest_0500"; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start1 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start1 failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility3", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start3 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start3 failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - console.log(TAG + " start after callbackid3 : " + JSON.stringify(globalThis.callbackid3)); - globalThis.abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid3) - .then((data) => { - console.info(TAG + ' unregisterAbilityLifecycleCallback3 successful. Data: ' + data); - }) - .catch((error) => { - console.error(TAG + ' unregisterAbilityLifecycleCallback3 failed. Cause: ' + JSON.stringify(error)); - }); - var str2 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility4", - } - globalThis.abilityContext.startAbility(str2) - .then((data) => { - console.info(TAG + ' start4 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start4 failed. Cause: ' + JSON.stringify(error)); - }) - }, 2800); - setTimeout(function () { - console.log(TAG + " listKey1 : " + JSON.stringify(globalThis.list1)); - console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1)); - console.log(TAG + " listKey3 : " + JSON.stringify(globalThis.list3)); - console.log(TAG + " callbackid3 : " + JSON.stringify(globalThis.callbackid3)); - let id3 = globalThis.callbackid3; - console.log(TAG + " listKey4 : " + JSON.stringify(globalThis.list4)); - console.log(TAG + " callbackid4 : " + JSON.stringify(globalThis.callbackid4)); - let id4 = globalThis.callbackid4; - expect(id3 + 1).assertEqual(id4); - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid4, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback4 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }) - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback1 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_0500 END-------------"); - done(); - }) - }, 4500); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0600 - * @tc.name Register in abilityA,start abilityB、abilityC,terminate abilityB 、abilityC - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0600", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0600 START-------------"); - TAG = "Singlehap_LifeCycleTest_0600"; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start1 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start1 failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility5", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start5 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start5 failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - var str2 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str2) - .then((data) => { - console.info(TAG + ' start2 successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start2 failed. Cause: ' + JSON.stringify(error)); - }) - }, 1100); - setTimeout(function () { - console.log(TAG + " listKey1 : " + JSON.stringify(globalThis.list1)); - console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list1.length; i++) { - strtemp = globalThis.list1[i].substring(0, 12); - if (strtemp == "MainAbility5" || strtemp == "MainAbility2") { - listtemp.push(globalThis.list1[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility5 onAbilityCreate"); - expect(exlist[1]).assertEqual("MainAbility5 onAbilityWindowStageCreate"); - expect(exlist[2]).assertEqual("MainAbility5 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[5]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[6]).assertEqual("MainAbility5 onAbilityBackground"); - expect(exlist[7]).assertEqual("MainAbility5 onAbilityWindowStageDestroy"); - expect(exlist[8]).assertEqual("MainAbility5 onAbilityDestroy"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[10]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[11]).assertEqual("MainAbility2 onAbilityDestroy"); - globalThis.ability1context.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_0600 END-------------"); - done(); - }) - }, 4200); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0700 - * @tc.name Multiple registration/unregistration - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0700", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0700 START-------------"); - TAG = "Singlehap_LifeCycleTest_0700"; - var code1; - var code2; - var code3; - var id1; - var id2; - var id3; - var listKey8 = []; - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log(TAG + " onAbilityCreate ability:" + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " onAbilityCreate abilityname:" + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityCreate"); - listKey8.push(abilityname + " onAbilityCreate"); - }, - onAbilityWindowStageCreate(ability) { - console.log(TAG + " onAbilityWindowStageCreate ability:" + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " onAbilityWindowStageCreate abilityname:" + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityWindowStageCreate"); - listKey8.push(abilityname + " onAbilityWindowStageCreate"); - }, - onAbilityWindowStageDestroy(ability) { - console.log(TAG + " AbilityLifecycleCallback1 onAbilityWindowStageDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " AbilityLifecycleCallback1 onAbilityWindowStageDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityWindowStageDestroy"); - listKey8.push(abilityname + " onAbilityWindowStageDestroy"); - }, - onAbilityDestroy(ability) { - console.log(TAG + " AbilityLifecycleCallback1 onAbilityDestroy ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " AbilityLifecycleCallback1 onAbilityDestroy abilityname:" - + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityDestroy"); - listKey8.push(abilityname + " onAbilityDestroy"); - }, - onAbilityForeground(ability) { - console.log(TAG + " AbilityLifecycleCallback1 onAbilityForeground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " AbilityLifecycleCallback1 onAbilityForeground abilityname:" - + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityForeground"); - listKey8.push(abilityname + " onAbilityForeground"); - }, - onAbilityBackground(ability) { - console.log(TAG + " AbilityLifecycleCallback1 onAbilityBackground ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " AbilityLifecycleCallback1 onAbilityBackground abilityname:" - + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityBackground"); - listKey8.push(abilityname + " onAbilityBackground"); - }, - onAbilityContinue(ability) { - console.log(TAG + " AbilityLifecycleCallback1 onAbilityContinue ability:" - + JSON.stringify(ability)); - let abilityname = ability.context.abilityInfo.name; - console.log(TAG + " AbilityLifecycleCallback1 onAbilityContinue abilityname:" - + JSON.stringify(abilityname)); - console.log(TAG + " " + abilityname + " onAbilityContinue"); - listKey8.push(abilityname + " onAbilityContinue"); - } - } - let applicationContext = globalThis.abilityContext.getApplicationContext(); - id1 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log(TAG + " registerAbilityLifecycleCallback1 number: " + JSON.stringify(id1)); - applicationContext.unregisterAbilityLifecycleCallback(id1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback1 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code1 = error.code; - }) - setTimeout(function () { - id2 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log(TAG + " registerAbilityLifecycleCallback2 number: " + JSON.stringify(id2)); - applicationContext.unregisterAbilityLifecycleCallback(id2, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback2 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code2 = error.code; - }) - }, 1000); - setTimeout(function () { - id3 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log(TAG + " registerAbilityLifecycleCallback3 number: " + JSON.stringify(id3)); - applicationContext.unregisterAbilityLifecycleCallback(id3, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback3 success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code3 = error.code; - expect(id1 > 0).assertTrue(); - expect(id2).assertEqual(id1 + 1); - expect(id3).assertEqual(id2 + 1); - expect(code1).assertEqual(0); - expect(code2).assertEqual(0); - expect(code3).assertEqual(0); - console.log("------------Singlehap_LifeCycleTest_0700 END-------------"); - done(); - }) - }, 3000); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0800 - * @tc.name Maninability1 Register listening, Repeat starting and termination Ability2 - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0800", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0800 START-------------"); - TAG = "Singlehap_LifeCycleTest_0800"; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 3000); - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 4500); - setTimeout(function () { - console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); - console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list1.length; i++) { - strtemp = globalThis.list1[i].substring(0, 12); - if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { - listtemp.push(globalThis.list1[i]); - } - } - console.log(TAG + " listtemp is :" + listtemp); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); - expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(exlist[10]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[11]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[12]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[13]).assertEqual("MainAbility1 onAbilityBackground"); - expect(exlist[14]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[15]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[16]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[17]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(exlist[18]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[19]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[20]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[21]).assertEqual("MainAbility1 onAbilityBackground"); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_0800 END-------------"); - done(); - }); - }, 4950); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_0900 - * @tc.name Repeat switching Ability1 between front and back - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_0900", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_0900 START-------------"); - TAG = "Singlehap_LifeCycleTest_0900"; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 2000); - setTimeout(function () { - console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); - console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list1.length; i++) { - strtemp = globalThis.list1[i].substring(0, 12); - if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { - listtemp.push(globalThis.list1[i]); - } - } - console.log(TAG + " listtemp is :" + listtemp); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); - expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(exlist[10]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[11]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[12]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[13]).assertEqual("MainAbility1 onAbilityBackground"); - expect(exlist[14]).assertEqual("MainAbility1 onAbilityForeground"); - expect(exlist[15]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[16]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[17]).assertEqual("MainAbility2 onAbilityDestroy"); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_0900 END-------------"); - done(); - }); - }, 4000); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1000 - * @tc.name Register listening in abilityA foreground,repeat the registration - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_1000", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1000 START-------------"); - TAG = "Singlehap_LifeCycleTest_1000"; - var id1; - var id2; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility6", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list6)); - console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid6)); - id1 = globalThis.callbackid6; - console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 2000); - setTimeout(function () { - console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list6)); - console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid6)); - id2 = globalThis.callbackid6; - console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); - expect(id1 + 1).assertEqual(id2); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid6, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_1000 END-------------"); - done(); - }); - }, 4500); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1100 - * @tc.name Register listening in abilityA foreground,repeat the registration (singleton) - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_1100", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1100 START-------------"); - TAG = "Singlehap_LifeCycleTest_1100"; - var id1; - var id2; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility7", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list7)); - console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid7)); - id1 = globalThis.callbackid7; - console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility7", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 2000); - setTimeout(function () { - console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list7)); - console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid7)); - id2 = globalThis.callbackid7; - console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); - expect(id1).assertEqual(id2); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid7, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - var para = { - resultCode: 1, - want: { - "abilityName": "MainAbility1", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); - globalThis.ability7.terminateSelfWithResult(para, (error, data) => { - console.log(TAG + " terminateSelfwithresult success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_1100 END-------------"); - done(); - }); - }, 4000); - }); - /* - * @tc.number Singlehap_LifeCycleTest_1200 - * @tc.name Register listening in abilityA foreground,repeat the registration (standard) - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_1200", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1200 START-------------"); - TAG = "Singlehap_LifeCycleTest_1200"; - var id1; - var id2; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility8", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list8)); - console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid8)); - id1 = globalThis.callbackid8; - console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility8", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 2000); - setTimeout(function () { - console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list8)); - console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid8)); - id2 = globalThis.callbackid8; - console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); - expect(id1 + 1).assertEqual(id2); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid8, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - var para = { - resultCode: 1, - want: { - "abilityName": "MainAbility8", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); - globalThis.ability8.terminateSelfWithResult(para, (error, data) => { - console.log(TAG + " terminateSelfwithresult success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_1200 END-------------"); - done(); - }); - }, 4000); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1300 - * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (singleton) - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_1300", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1300 start-------------"); - TAG = "Singlehap_LifeCycleTest_1300"; - listKeyTemp = []; - abilityContext.startAbility({ - bundleName: "com.example.lifecycle_xts", - abilityName: "MainAbility9" - }, (error, data) => { - console.log(TAG + ": MainAbility9 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - await sleep(500); - abilityContext.startAbility({ - bundleName: "com.example.lifecycle_xts", - abilityName: "Hap1MainAbility1" - }, (error, data) => { - console.log(TAG + ":first Hap1MainAbility1 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - await sleep(500); - abilityContext.startAbility({ - bundleName: "com.example.lifecycle_xts", - abilityName: "Hap1MainAbility1" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap1MainAbility1 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for (var i = 0; i < globalThis.mainAbility9ListKey.length; i++) { - if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility1") { - listKeyTemp.push(globalThis.mainAbility9ListKey[i]); - } - } - console.log(TAG + "listKeyTemp is :" + listKeyTemp); - console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap1MainAbility1 onAbilityCreate"); - expect(listKeyTemp[1]).assertEqual("Hap1MainAbility1 onAbilityWindowStageCreate"); - expect(listKeyTemp[2]).assertEqual("Hap1MainAbility1 onAbilityForeground"); - expect(listKeyTemp[3]).assertEqual("Hap1MainAbility1 onAbilityBackground"); - expect(listKeyTemp[4]).assertEqual("Hap1MainAbility1 onAbilityWindowStageDestroy"); - expect(listKeyTemp[5]).assertEqual("Hap1MainAbility1 onAbilityDestroy"); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - done(); - }); - }, 3000) - }); - console.log("------------Singlehap_LifeCycleTest_1300 end-------------"); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1400 - * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (standard) - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_1400", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1400 start-------------"); - TAG = "Singlehap_LifeCycleTest_1400"; - listKeyTemp = []; - abilityContext.startAbility({ - bundleName: "com.example.lifecycle_xts", - abilityName: "MainAbility9" - }, (error, data) => { - console.log(TAG + ": MainAbility9 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - await sleep(500); - abilityContext.startAbility({ - bundleName: "com.example.lifecycle_xts", - abilityName: "Hap1MainAbility2" - }, (error, data) => { - console.log(TAG + ":first Hap1MainAbility2 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - await sleep(500); - abilityContext.startAbility({ - bundleName: "com.example.lifecycle_xts", - abilityName: "Hap1MainAbility2" - }, (error, data) => { - setTimeout(() => { - console.log(TAG + ": second Hap1MainAbility2 startAbility success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - for (var i = 0;i < globalThis.mainAbility9ListKey.length; i++) { - if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility2") { - listKeyTemp.push(globalThis.mainAbility9ListKey[i]); - } - } - console.log(TAG + "listKeyTemp is :" + listKeyTemp); - console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap1MainAbility2 onAbilityCreate"); - expect(listKeyTemp[1]).assertEqual("Hap1MainAbility2 onAbilityWindowStageCreate"); - expect(listKeyTemp[2]).assertEqual("Hap1MainAbility2 onAbilityForeground"); - expect(listKeyTemp[3]).assertEqual("Hap1MainAbility2 onAbilityCreate"); - expect(listKeyTemp[4]).assertEqual("Hap1MainAbility2 onAbilityWindowStageCreate"); - expect(listKeyTemp[5]).assertEqual("Hap1MainAbility2 onAbilityForeground"); - expect(listKeyTemp[6]).assertEqual("Hap1MainAbility2 onAbilityBackground"); - expect(listKeyTemp[7]).assertEqual("Hap1MainAbility2 onAbilityWindowStageDestroy"); - expect(listKeyTemp[8]).assertEqual("Hap1MainAbility2 onAbilityDestroy"); - expect(listKeyTemp[9]).assertEqual("Hap1MainAbility2 onAbilityBackground"); - expect(listKeyTemp[10]).assertEqual("Hap1MainAbility2 onAbilityWindowStageDestroy"); - expect(listKeyTemp[11]).assertEqual("Hap1MainAbility2 onAbilityDestroy"); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - done(); - }); - }, 3000) - }); - console.log("------------Singlehap_LifeCycleTest_1400 end-------------"); - }); - /* - * @tc.number Singlehap_LifeCycleTest_1500 - * @tc.name Register in abilityA , starting and termination AbilityB,Repeat previous steps (standard) - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_1500", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1500 START-------------"); - TAG = "Singlehap_LifeCycleTest_1500"; - var id1; - var id2; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility11", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list11)); - console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid11)); - id1 = globalThis.callbackid11; - console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility11", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 1000); - }, 3000); - setTimeout(function () { - console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list11)); - console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid11)); - id2 = globalThis.callbackid11; - console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list11.length; i++) { - strtemp = globalThis.list11[i].substring(0, 12); - if (strtemp == "MainAbility2") { - listtemp.push(globalThis.list11[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(id1 + 1).assertEqual(id2); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid11, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_1500 END-------------"); - done(); - }); - }, 6000); - }); - - var callbackid_NA = 100 - var callbackid_errorNum = -1 - var callbackid_errorType = "test" - /* - * @tc.number Singlehap_LifeCycleTest_1600 - * @tc.name input Nonexistent callbackid for unregisterAbilityLifecycleCallback parameter - * @tc.desc Function test - * @tc.level 1 - */ - it("Singlehap_LifeCycleTest_1600", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1600 START-------------"); - TAG = "Singlehap_LifeCycleTest_1600"; - let code; - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(callbackid_NA, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - sleep(1000); - expect(code).assertEqual(1); - done(); - }); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1700 - * @tc.name input error callbackid for unregisterAbilityLifecycleCallback parameter - * @tc.desc Function test - * @tc.level 1 - */ - it("Singlehap_LifeCycleTest_1700", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1700 START-------------"); - TAG = "Singlehap_LifeCycleTest_1700"; - let code; - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(callbackid_errorNum, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - sleep(1000); - expect(code).assertEqual(1); - done(); - }); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1800 - * @tc.name input error type callbackid for unregisterAbilityLifecycleCallback parameter - * @tc.desc Function test - * @tc.level 1 - */ - it("Singlehap_LifeCycleTest_1800", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1800 START-------------"); - TAG = "Singlehap_LifeCycleTest_1800"; - let code; - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(callbackid_errorType, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - sleep(1000); - expect(code).assertEqual(1); - done(); - }); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_1900 - * @tc.name input null callbackid for unregisterAbilityLifecycleCallback parameter - * @tc.desc Function test - * @tc.level 1 - */ - it("Singlehap_LifeCycleTest_1900", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_1900 START-------------"); - TAG = "Singlehap_LifeCycleTest_1900"; - let code; - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(null, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - code = error.code; - sleep(1000); - expect(code).assertEqual(1); - done(); - }); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_2000 - * @tc.name Register in abilityA, starting and termination AbilityB, terminate abilityA, Re-register in abilityA - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_2000", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_2000 START-------------"); - TAG = "Singlehap_LifeCycleTest_2000"; - var id1; - var id2; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility12", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - setTimeout(function () { - console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list12)); - console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid12)); - id1 = globalThis.callbackid12; - console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); - var para = { - resultCode: 2000, - want: { - "abilityName": "MainAbility12", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); - globalThis.ability12.terminateSelfWithResult(para) - .then((data) => { - console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); - }); - }, 2500); - setTimeout(function () { - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility12", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - }, 4000); - setTimeout(function () { - console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list12)); - console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid12)); - id2 = globalThis.callbackid12; - console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < globalThis.list12.length; i++) { - strtemp = globalThis.list12[i].substring(0, 12); - if (strtemp == "MainAbility2") { - listtemp.push(globalThis.list12[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(id1 + 1).assertEqual(id2); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid6, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_2000 END-------------"); - done(); - }); - }, 6200); - }); - - /* - * @tc.number Singlehap_LifeCycleTest_2100 - * @tc.name Register in abilityA,register in abilityB, starting and termination abilityC, - termination abilityB、abilityA, Re-register in abilityA、abilityB - * @tc.desc Function test - * @tc.level 0 - */ - it("Singlehap_LifeCycleTest_2100", 0, async function (done) { - console.log("------------Singlehap_LifeCycleTest_2100 START-------------"); - TAG = "Singlehap_LifeCycleTest_2100"; - var id1; - var id2; - var id3; - var id4; - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility12", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str2 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str2) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - }, 500); - setTimeout(function () { - console.log(TAG + " firstCallback listKey1 : " + JSON.stringify(globalThis.list1)); - console.log(TAG + " firstCallback callbackid1 : " + JSON.stringify(globalThis.callbackid1)); - console.log(TAG + " firstCallback listKey12 : " + JSON.stringify(globalThis.list12)); - console.log(TAG + " firstCallback callbackid12 : " + JSON.stringify(globalThis.callbackid12)); - id1 = globalThis.callbackid1; - console.log(TAG + " firstCallback id1 : " + JSON.stringify(id1)); - id2 = globalThis.callbackid12; - console.log(TAG + " firstCallback id12 : " + JSON.stringify(id2)); - var para = { - resultCode: 2100, - want: { - "abilityName": "MainAbility12", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); - globalThis.ability12.terminateSelfWithResult(para) - .then((data) => { - console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); - }); - setTimeout(function () { - var para = { - resultCode: 2100, - want: { - "abilityName": "MainAbility1", - "bundleName": "com.example.lifecycle_xts" - } - } - console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); - globalThis.ability1context.terminateSelfWithResult(para) - .then((data) => { - console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); - }); - }, 500); - }, 3000); - setTimeout(function () { - var str = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility1", - } - globalThis.abilityContext.startAbility(str) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str1 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility12", - } - globalThis.abilityContext.startAbility(str1) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - setTimeout(function () { - var str2 = { - "bundleName": "com.example.lifecycle_xts", - "abilityName": "MainAbility2", - } - globalThis.abilityContext.startAbility(str2) - .then((data) => { - console.info(TAG + ' start successful. Data: ' + data); - }).catch((error) => { - console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); - }) - }, 500); - }, 500); - }, 4000); - setTimeout(function () { - console.log(TAG + " secondCallback listKey1 : " + JSON.stringify(globalThis.list1)); - let templist1 = globalThis.list1; - console.log(TAG + " secondCallback templist1 : " + JSON.stringify(templist1)); - console.log(TAG + " secondCallback callbackid1 : " + JSON.stringify(globalThis.callbackid1)); - console.log(TAG + " secondCallback listKey12 : " + JSON.stringify(globalThis.list12)); - let templist2 = globalThis.list12; - console.log(TAG + " secondCallback templist2 : " + JSON.stringify(templist2)); - console.log(TAG + " secondCallback callbackid12 : " + JSON.stringify(globalThis.callbackid12)); - id3 = globalThis.callbackid1; - console.log(TAG + " secondCallback id1 : " + JSON.stringify(id3)); - id4 = globalThis.callbackid12; - console.log(TAG + " secondCallback id12 : " + JSON.stringify(id4)); - var strtemp = ""; - var listtemp = []; - for (var i = 0; i < templist1.length; i++) { - strtemp = templist1[i].substring(0, 13); - if (strtemp === "MainAbility2 " || strtemp === "MainAbility12") { - listtemp.push(templist1[i]); - } - } - console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - setTimeout(function () { - var strtemp1 = ""; - var listtemp1 = []; - for (var j = 0; j < templist2.length; j++) { - strtemp1 = templist2[j].substring(0, 12); - if (strtemp1 === "MainAbility2") { - listtemp1.push(templist2[j]); - } - } - console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1)); - let exlist = listtemp; - let exlist1 = listtemp1; - expect(exlist[0]).assertEqual("MainAbility12 onAbilityCreate"); - expect(exlist[1]).assertEqual("MainAbility12 onAbilityWindowStageCreate"); - expect(exlist[2]).assertEqual("MainAbility12 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist[5]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[6]).assertEqual("MainAbility12 onAbilityBackground"); - expect(exlist[7]).assertEqual("MainAbility12 onAbilityForeground"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist[10]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(exlist1[0]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist1[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); - expect(exlist1[2]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist1[3]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist1[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); - expect(exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(id1 + 1).assertEqual(id2); - expect(id3 + 1).assertEqual(id4); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid12, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - }); - abilityContext.getApplicationContext() - .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { - console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + - ",data: " + JSON.stringify(data)); - console.log("------------Singlehap_LifeCycleTest_2100 END-------------"); - done(); - }); - }, 100); - }, 7000); - }); - }) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets deleted file mode 100644 index 646c6703042954025e95ff44a0883670fbb82e87..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets +++ /dev/null @@ -1,19 +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 LifeCycleTest from './LifeCycleTest' - -export default function List(context) { - LifeCycleTest(context) -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/module.json b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/module.json deleted file mode 100644 index dc2ba99f84fc6f561155c1d8289051de5d6359be..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/module.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [{ - "name": "com.example.lifecycle_xts.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" - ] - }] - }, - { - "name": "MainAbility1", - "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", - "description": "$string:MainAbility1_desc", - "icon": "$media:icon", - "label": "$string:MainAbility1_label" - }, - { - "name": "MainAbility2", - "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", - "description": "$string:MainAbility2_desc", - "icon": "$media:icon", - "label": "$string:MainAbility2_label" - }, - { - "name": "MainAbility3", - "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", - "description": "$string:MainAbility3_desc", - "icon": "$media:icon", - "label": "$string:MainAbility3_label" - }, - { - "name": "MainAbility4", - "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", - "description": "$string:MainAbility4_desc", - "icon": "$media:icon", - "label": "$string:MainAbility4_label" - }, - { - "name": "MainAbility5", - "srcEntrance": "./ets/MainAbility5/MainAbility5.ts", - "description": "$string:MainAbility5_desc", - "icon": "$media:icon", - "label": "$string:MainAbility5_label" - }, - { - "name": "MainAbility6", - "srcEntrance": "./ets/MainAbility6/MainAbility6.ts", - "description": "$string:MainAbility6_desc", - "icon": "$media:icon", - "label": "$string:MainAbility6_label" - }, - { - "name": "MainAbility7", - "srcEntrance": "./ets/MainAbility7/MainAbility7.ts", - "description": "$string:MainAbility7_desc", - "launchType": "singleton", - "icon": "$media:icon", - "label": "$string:MainAbility7_label" - }, - { - "name": "MainAbility8", - "srcEntrance": "./ets/MainAbility8/MainAbility8.ts", - "description": "$string:MainAbility8_desc", - "launchType": "standard", - "icon": "$media:icon", - "label": "$string:MainAbility8_label" - }, - { - "name": "MainAbility9", - "srcEntrance": "./ets/MainAbility9/MainAbility9.ts", - "description": "$string:MainAbility9_desc", - "icon": "$media:icon", - "label": "$string:MainAbility9_label" - }, - { - "name": "Hap1MainAbility1", - "srcEntrance": "./ets/Hap1MainAbility1/Hap1MainAbility1.ts", - "description": "$string:Hap1MainAbility1_desc", - "icon": "$media:icon", - "label": "$string:Hap1MainAbility1_label", - "launchType": "singleton" - }, - { - "name": "Hap1MainAbility2", - "srcEntrance": "./ets/Hap1MainAbility2/Hap1MainAbility2.ts", - "description": "$string:Hap1MainAbility2_desc", - "icon": "$media:icon", - "label": "$string:Hap1MainAbility2_label", - "launchType": "standard" - }, - { - "name": "MainAbility10", - "srcEntrance": "./ets/MainAbility10/MainAbility10.ts", - "description": "$string:MainAbility10_desc", - "icon": "$media:icon", - "label": "$string:MainAbility10_label" - }, - { - "name": "MainAbility11", - "srcEntrance": "./ets/MainAbility11/MainAbility11.ts", - "description": "$string:MainAbility11_desc", - "icon": "$media:icon", - "label": "$string:MainAbility11_label", - "launchType": "standard" - }, - { - "name": "MainAbility12", - "srcEntrance": "./ets/MainAbility12/MainAbility12.ts", - "description": "$string:MainAbility12_desc", - "icon": "$media:icon", - "label": "$string:MainAbility12_label" - }] - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/element/string.json deleted file mode 100644 index e078d4fa7b763800490e3c70a8ea063aa6155ad8..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,160 +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": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "MainAbility1_desc", - "value": "description" - }, - { - "name": "MainAbility1_label", - "value": "label" - }, - { - "name": "MainAbility2_desc", - "value": "description" - }, - { - "name": "MainAbility2_label", - "value": "label" - }, - { - "name": "MainAbility3_desc", - "value": "description" - }, - { - "name": "MainAbility3_label", - "value": "label" - }, - { - "name": "MainAbility4_desc", - "value": "description" - }, - { - "name": "MainAbility4_label", - "value": "label" - }, - { - "name": "MainAbility5_desc", - "value": "description" - }, - { - "name": "MainAbility5_label", - "value": "label" - }, - { - "name": "MainAbility6_desc", - "value": "description" - }, - { - "name": "MainAbility6_label", - "value": "label" - }, - { - "name": "MainAbility7_desc", - "value": "description" - }, - { - "name": "MainAbility7_label", - "value": "label" - }, - { - "name": "MainAbility8_desc", - "value": "description" - }, - { - "name": "MainAbility8_label", - "value": "label" - }, - { - "name": "MainAbility9_desc", - "value": "description" - }, - { - "name": "MainAbility9_label", - "value": "label" - }, - { - "name": "Hap1MainAbility1_desc", - "value": "description" - }, - { - "name": "Hap1MainAbility1_label", - "value": "label" - }, - { - "name": "Hap1MainAbility2_desc", - "value": "description" - }, - { - "name": "Hap1MainAbility2_label", - "value": "label" - }, - { - "name": "MainAbility10_desc", - "value": "description" - }, - { - "name": "MainAbility10_label", - "value": "label" - }, - { - "name": "MainAbility11_desc", - "value": "description" - }, - { - "name": "MainAbility11_label", - "value": "label" - }, - { - "name": "MainAbility12_desc", - "value": "description" - }, - { - "name": "MainAbility12_label", - "value": "label" - }, - { - "name": "MainAbility13_desc", - "value": "description" - }, - { - "name": "MainAbility13_label", - "value": "label" - } - ] -} diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/app.js deleted file mode 100644 index 2ba842eda9d2f61221fca73dfb53c2a2903fc3e4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index d405647b90183b99fb4e15025a9fe12c85c495d4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js b/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js deleted file mode 100755 index 35e245da161bb63acd8bb2c87a7cb8f832582b7c..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js +++ /dev/null @@ -1,1602 +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 featureAbility from '@ohos.ability.featureAbility' -import wantConstant from '@ohos.ability.wantConstant' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsGetWantTest', function () { - beforeAll(async (done) => { - console.info('ActsGetWantTest begin') - done(); - }) - - var TIMEOUT_NUMBER = 2500; - - // @tc.number: ACTS_GetWant_0100 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_0100', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - parameters: - { - mykey0: 1, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmony"], - }, - } - }).then((data) => { - console.info('====> ACTS_GetWant_0100 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.parameters.mykey0).assertEqual(1); - expect(data.want.parameters.mykey1[0]).assertEqual(1); - expect(data.want.parameters.mykey1[1]).assertEqual(2); - expect(data.want.parameters.mykey1[2]).assertEqual(3); - expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_0100 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - // @tc.number: ACTS_GetWant_0200 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_0200', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - parameters: - { - mykey0: 1, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmony"], - }, - } - }, - (err, data) => { - console.info('====> ACTS_GetWant_0200 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.parameters.mykey0).assertEqual(1); - expect(data.want.parameters.mykey1[0]).assertEqual(1); - expect(data.want.parameters.mykey1[1]).assertEqual(2); - expect(data.want.parameters.mykey1[2]).assertEqual(3); - expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - // @tc.number: ACTS_GetWant_0300 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_0300', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action2", - entities: ["entity1", "entity2"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.3], - mykey2: "[1, 2, 3]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "!@#$%", "helloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult0300(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_0300 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - function checkOnAbilityResult0300(data) { - console.info('====> ACTS_GetWant_0300 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action2"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.entities[1]).assertEqual("entity2"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.3); - expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); - console.info('====> ACTS_GetWant_0300 before done=====>') - } - - // @tc.number: ACTS_GetWant_0400 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_0400', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action2", - entities: ["entity1", "entity2"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.3], - mykey2: "[1, 2, 3]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "!@#$%", "helloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult0400(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult0400(data) { - console.info('====> ACTS_GetWant_0400 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action2"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.entities[1]).assertEqual("entity2"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.3); - expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); - console.info('====> ACTS_GetWant_0400 before done=====>') - } - - // @tc.number: ACTS_GetWant_0500 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_0500', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - console.info('====> ACTS_GetWant_0500 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_0500 before done=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_0500 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - // @tc.number: ACTS_GetWant_0600 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_0600', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - console.info('====> ACTS_GetWant_0600 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_0600 before done=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - // @tc.number: ACTS_GetWant_0700 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_0700', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - console.info('====> ACTS_GetWant_0700 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_0700 before done=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_0700 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - // @tc.number: ACTS_GetWant_0800 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_0800', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult0800(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult0800(data) { - console.info('====> ACTS_GetWant_0800 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_0800 before done=====>') - } - - // @tc.number: ACTS_GetWant_0900 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_0900', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - console.info('====> ACTS_GetWant_0900 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_0900 before done=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_0900 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - // @tc.number: ACTS_GetWant_1000 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_1000', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult1000(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult1000(data) { - console.info('====> ACTS_GetWant_1000 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1000 before done=====>') - } - - // @tc.number: ACTS_GetWant_1100 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_1100', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult1100(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_1100 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - function checkOnAbilityResult1100(data) { - console.info('====> ACTS_GetWant_1100 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1100 before done=====>') - } - - // @tc.number: ACTS_GetWant_1200 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_1200', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - console.info('====> ACTS_GetWant_1200 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1200 before done=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - // @tc.number: ACTS_GetWant_1300 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_1300', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - console.info('====> ACTS_GetWant_1300 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1300 before done=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_1300 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - // @tc.number: ACTS_GetWant_1400 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_1400', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult1400(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult1400(data) { - console.info('====> ACTS_GetWant_1400 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1400 before done=====>') - } - - // @tc.number: ACTS_GetWant_1500 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_1500', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult1500(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_1500 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - function checkOnAbilityResult1500(data) { - console.info('====> ACTS_GetWant_1500 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE ); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1500 setTimeout before done.=====>') - } - - // @tc.number: ACTS_GetWant_1600 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_1600', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - console.info('====> ACTS_GetWant_1600 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE ); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1600 setTimeout before done.=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - // @tc.number: ACTS_GetWant_1700 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_1700', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - console.info('====> ACTS_GetWant_1700 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY ); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1700 setTimeout before done.=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_1700 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - // @tc.number: ACTS_GetWant_1800 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_1800', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - console.info('====> ACTS_GetWant_1800 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY ); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1800 setTimeout before done.=====>') - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - // @tc.number: ACTS_GetWant_1900 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_1900', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult1900(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_1900 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - function checkOnAbilityResult1900(data) { - console.info('====> ACTS_GetWant_1900 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_1900 setTimeout before done.=====>') - } - - // @tc.number: ACTS_GetWant_2000 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_2000', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult2000(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult2000(data) { - console.info('====> ACTS_GetWant_2000 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_2000 setTimeout before done.=====>') - } - - // @tc.number: ACTS_GetWant_2100 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_2100', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult2100(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_2100 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - function checkOnAbilityResult2100(data) { - console.info('====> ACTS_GetWant_2100 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_2100 setTimeout before done.=====>') - } - - // @tc.number: ACTS_GetWant_2200 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_2200', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult2200(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult2200(data) { - console.info('====> ACTS_GetWant_2200 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_2200 setTimeout before done.=====>') - } - - // @tc.number: ACTS_GetWant_2300 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by promise) - it('ACTS_GetWant_2300', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult2300(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_2300 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }) - - function checkOnAbilityResult2300(data) { - console.info('====> ACTS_GetWant_2300 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_2300 setTimeout before done.=====>') - } - - // @tc.number: ACTS_GetWant_2400 - // @tc.name: getWant : get want in current ability - // @tc.desc:Start the ability through startabilityforresult, - // and then use terminateselfwithresult to return the data (by callback) - it('ACTS_GetWant_2400', 0, async function (done) { - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.0000000003], - mykey2: "[a, b, c]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult2400(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }) - - function checkOnAbilityResult2400(data) { - console.info('====> ACTS_GetWant_2400 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action1"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); - expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("STR"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); - console.info('====> ACTS_GetWant_2400 setTimeout before done.=====>') - } - - /* - * @tc.number ACTS_GetWant_2500 - * @tc.name Misconfigured bundlename validation - * @tc.desc Function test (by promise) - * @tc.level 0 - */ - it("ACTS_GetWant_2500",0, async function(done){ - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action2", - entities: ["entity1", "entity2"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.3], - mykey2: "[1, 2, 3]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "test123", "helloopenharmony"], - }, - }, - }).then((data) => { - checkOnAbilityResult2500(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }).catch((error) => { - console.log('ACTS_GetWant_2500 error: ' + JSON.stringify(error)) - expect.assertFail() - done(); - }) - }); - - function checkOnAbilityResult2500(data) { - console.info('====> ACTS_GetWant_2500 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action2"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT ); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.3); - expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("test123"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); - console.info('====> ACTS_GetWant_2500 before done=====>') - } - - /* - * @tc.number ACTS_GetWant_2600 - * @tc.name Misconfigured bundlename validation - * @tc.desc Function test (by callback) - * @tc.level 0 - */ - it("ACTS_GetWant_2600",0, async function(done){ - featureAbility.startAbilityForResult({ - want: - { - deviceId: "", - bundleName: "com.example.actsgetwantalltesthap", - abilityName: "com.example.actsgetwantalltesthap.MainAbility", - action: "action2", - entities: ["entity1", "entity2"], - type: "MIMETYPE", - uri: "key={true,true,false}", - flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, - parameters: - { - mykey0: 0.1, - mykey1: [0.1, 0.2, 0.3], - mykey2: "[1, 2, 3]", - mykey3: "str", - mykey4: [false, true, false], - mykey5: ["str", "test123", "helloopenharmony"], - }, - }, - }, - (err, data) => { - checkOnAbilityResult2600(data); - setTimeout(()=>{ - done(); - }, TIMEOUT_NUMBER); - }) - }); - - function checkOnAbilityResult2600(data) { - console.info('====> ACTS_GetWant_2600 start ability=====>' + JSON.stringify(data)) - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); - expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); - expect(data.want.action).assertEqual("action2"); - expect(data.want.entities[0]).assertEqual("entity1"); - expect(data.want.type).assertEqual("MIMETYPE"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT ); - expect(data.want.parameters.mykey0).assertEqual(0.1); - expect(data.want.parameters.mykey1[0]).assertEqual(0.1); - expect(data.want.parameters.mykey1[1]).assertEqual(0.2); - expect(data.want.parameters.mykey1[2]).assertEqual(0.3); - expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); - expect(data.want.parameters.mykey3).assertEqual("str"); - expect(data.want.parameters.mykey4[0]).assertEqual(false); - expect(data.want.parameters.mykey4[1]).assertEqual(true); - expect(data.want.parameters.mykey4[2]).assertEqual(false); - expect(data.want.parameters.mykey5[0]).assertEqual("str"); - expect(data.want.parameters.mykey5[1]).assertEqual("test123"); - expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); - console.info('====> ACTS_GetWant_2600 before done=====>') - } - - /** - * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0100 - * @tc.name: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant. - * @tc.desc: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant. - */ - it('SUB_AA_OpenHarmony_wantConstantEnumeration_0100',0, async function (done) { - console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- start") - let image = wantConstant.Action.ACTION_IMAGE_CAPTURE - expect(image).assertEqual("ohos.want.action.imageCapture") - console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- end") - done() - }) - - /** - * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0200 - * @tc.name: Check the enumerated value ACTION_VIDEO_CAPTURE of wantConstant. - * @tc.desc: Check the enumerated value ACTION_VIDEO_CAPTURE of wantCconstant. - */ - it('SUB_AA_OpenHarmony_wantConstantEnumeration_0200',0, async function (done) { - console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- start") - let video = wantConstant.Action.ACTION_VIDEO_CAPTURE - expect(video).assertEqual("ohos.want.action.videoCapture") - console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- end") - done() - }) - - /** - * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0300 - * @tc.name: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant. - * @tc.desc: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant. - */ - it('SUB_AA_OpenHarmony_wantConstantEnumeration_0300',0, async function (done) { - console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- start") - let app = wantConstant.Action.ACTION_APP_ACCOUNT_OAUTH - expect(app).assertEqual("ohos.account.appAccount.action.oauth") - console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- end") - done() - }) -}) diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/List.test.js deleted file mode 100644 index cd9d94dce59d8f5205f3d68bbfcef42d4dca9191..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,16 +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. - */ - -require('./ActsGetWantAllTest.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js b/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js deleted file mode 100644 index 2ba842eda9d2f61221fca73dfb53c2a2903fc3e4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/element/string.json deleted file mode 100644 index d405647b90183b99fb4e15025a9fe12c85c495d4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/Test.json b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/Test.json deleted file mode 100755 index 00594c18413b8e10e7a2f9df0717edcd8a996a10..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/Test.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.example.zidlclienttest", - "shell-timeout": "300000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAmsZidlClientTest.hap", - "ActsAmsZidlServiceRelyHap.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 644 /data/*.hap" - ] - } - ] -} diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index d9ce38a659aabf98179dd813759aabf7d40739c6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,433 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -import {voidOutStringCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOutIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutStringCallback} from "./zidlTool/i_zidl_tool_test"; -import {booleanVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {byteVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {shortVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {intVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {longVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {floatVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {doubleVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {stringVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {sequenceableVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {interfaceVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {mapStringStringVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {doubleArrayVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOrderOutInCallback} from "./zidlTool/i_zidl_tool_test" -import {voidOrderInOutInCallback} from "./zidlTool/i_zidl_tool_test" -import {voidOrderOutInOutCallback} from "./zidlTool/i_zidl_tool_test" -import {voidOrderInInOutOutCallback} from "./zidlTool/i_zidl_tool_test" -import {onewayVoidVoidCallback} from "./zidlTool/i_zidl_tool_test" -import {voidInMapStringIntCallback} from "./zidlTool/i_zidl_tool_test" -import {voidVoidCallback} from "./zidlTool/i_zidl_tool_test" -import {voidInStringArrayCallback} from "./zidlTool/i_zidl_tool_test" -import ZidlTestServiceStub from './zidlTool/zidl_tool_test_stub'; -import MySequenceable from "./zidlTool/my_sequenceable"; -import InterfaceDeclareProxy from './interfaceDeclare/interface_declare_proxy' -import InterfaceDeclareStub from './interfaceDeclare/interface_declare_stub' -import {voidInIntCallback} from "./zidlTool/i_zidl_tool_test" -import {voidInStringCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeBooleanCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeByteCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeShortCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeIntCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeLongCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeFloatCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeDoubleCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeStringCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeSequenceableCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeInterfaceCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeMapStringStringCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeDoubleArrayCallback} from "./zidlTool/i_zidl_tool_test" -import {testInterfaceCallback} from './interfaceDeclare/i_interface_declare' - -var SUCCESS = 0; -var FAIL = 1; - -class ZidlTestImp extends ZidlTestServiceStub { - - onewayVoidVoid(callback: onewayVoidVoidCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0200 called"); - callback(SUCCESS); - } - - voidVoid(callback: voidVoidCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0300 called"); - callback(SUCCESS); - } - - booleanVoid(callback: booleanVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0400 called"); - var boolean = true; - callback(SUCCESS, boolean); - } - - byteVoid(callback: byteVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0500 called"); - var mybyte = 1; - callback(SUCCESS, mybyte); - } - - shortVoid(callback: shortVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0600 called"); - var myshort = 222; - callback(SUCCESS, myshort); - } - - intVoid(callback: intVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0700 called"); - var myint = 333; - callback(SUCCESS, myint); - } - - longVoid(callback: longVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0800 called"); - var mylong = 4444; - callback(SUCCESS, mylong); - } - - floatVoid(callback: floatVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0900 called"); - var myfloat = 10.1; - callback(SUCCESS, myfloat); - } - - doubleVoid(callback: doubleVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1000 called"); - var mydouble = 22.1; - callback(SUCCESS, mydouble); - } - - stringVoid(callback: stringVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1100 called"); - var mystring = "stringVoid"; - callback(SUCCESS, mystring); - } - - sequenceableVoid(callback: sequenceableVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1200 called"); - let mySequence = new MySequenceable(); - callback(SUCCESS, mySequence); - } - - interfaceVoid(callback: interfaceVoidCallback) { - class InterfaceDeclare extends InterfaceDeclareStub { - testInterface(data: number, callback: testInterfaceCallback): void{ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1300 interfaceStub called"); - let result = FAIL; - - if (data == 1500) { - result = SUCCESS; - } - callback(result); - } - } - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1300 toolStub called"); - let serverInterface = new InterfaceDeclare('serverInterface'); - callback(SUCCESS, serverInterface); - } - - mapStringStringVoid(callback: mapStringStringVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1400 called"); - let myMap = new Map(); - myMap.set("string1","string2"); - callback(SUCCESS, myMap); - } - - doubleArrayVoid(callback: doubleArrayVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1500 called"); - var array = [1.1, 2.1, 3.1]; - callback(SUCCESS, array); - } - - voidInMapStringInt(myMap, callback: voidInMapStringIntCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1600_1 called:'+ myMap.get("string1")); - if(myMap.get("string1") == 1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidInStringArray(strarray, callback: voidInStringArrayCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1600_2 called:"+ JSON.stringify(strarray)); - if(strarray[0] == "aaa"&&strarray[1] == "bbb"&&strarray[2] == "ccc"){ - callback(SUCCESS); - }else { - callback(FAIL); - } - } - - voidOutMapStringInt(callback : voidOutMapStringIntCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1700 called'); - var map=new Map(); - map.set("voidOutMapStringInt", 1); - callback(SUCCESS, map); - } - - voidOutStringArray(callback :voidOutStringArrayCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1700 called'); - var strarray = ["aa", "dd"]; - callback(SUCCESS, strarray); - } - - voidInOutMapStringInt(mapIn, callback: voidInOutMapStringIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1800 called'); - var errCode = FAIL; - if ((mapIn.get("voidInOutMapStringInt1") == 1801) && - (mapIn.get("voidInOutMapStringInt2") == 1802)) { - mapIn.set("voidInOutMapStringInt1", 1802); - mapIn.set("voidInOutMapStringInt2", 1801); - errCode = SUCCESS; - } - callback(errCode, mapIn); - } - - voidInOutStringArray(strArrayIn, callback: voidInOutStringArrayCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1800 called'); - var errCode = FAIL; - if ((strArrayIn[0] == "ddd") && - (strArrayIn[1] == "ccc")) { - strArrayIn[0] = "aaa"; - strArrayIn[1] = "bbb"; - errCode = SUCCESS; - } - callback(errCode, strArrayIn); - } - - voidInInt(number, callback : voidInIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1900 called:'+ JSON.stringify(number)); - if(number == 8888){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidInString(string, callback : voidInStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1900 called:'+ JSON.stringify(string)); - if(string == "voidInString"){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidOutInt(callback : voidOutIntCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2000 called'); - var number = 123; - callback(SUCCESS, number); - } - - voidOutString(callback : voidOutStringCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2000 called'); - var string = "voidOutString"; - callback(SUCCESS, string); - } - - voidInOutInt(number, callback: voidInOutIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_1 called:'+ JSON.stringify(number)); - var num = 456789; - if(number == 123456){ - callback(SUCCESS, num); - }else{ - callback(FAIL, number); - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_1 Call_Fail') - } - } - voidInOutString(strinput, callback: voidInOutStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_2 called:'+ JSON.stringify(strinput)); - var str = "456789"; - if(strinput == "voidInOutString"){ - callback(SUCCESS, str); - }else{ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_2 Call_Fail'); - callback(FAIL, strinput); - } - } - - voidParameterTypeBoolean(oBooleanTrue, callback : voidParameterTypeBooleanCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2200 called:'+ JSON.stringify(oBooleanTrue)); - if(oBooleanTrue == true){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeByte(number, callback : voidParameterTypeByteCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2300 called:'+ JSON.stringify(number)); - if(number == 1111){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeShort(number, callback : voidParameterTypeShortCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2400 called:'+ JSON.stringify(number)); - if(number == 2222){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeInt(number, callback : voidParameterTypeIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2500 called:'+ JSON.stringify(number)); - if(number == 3333){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeLong(number, callback : voidParameterTypeLongCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2600 called:'+ JSON.stringify(number)); - if(number == 4444){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeFloat(number, callback : voidParameterTypeFloatCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2700 called:'+ JSON.stringify(number)); - if(number == 5555.1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeDouble(number, callback : voidParameterTypeDoubleCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2800 called:'+ JSON.stringify(number)); - if(number == 6666.1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeString(string, callback : voidParameterTypeStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2900 called:'+ JSON.stringify(string)); - if(string == "voidParameterTypeString"){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeSequenceable(MySequenceable, callback : voidParameterTypeSequenceableCallback) { - console.log('ZidlTest Process Server ACTS_Zidl_Js2JsSingle_3000 called:'+ JSON.stringify(MySequenceable)); - if((MySequenceable != null) && (MySequenceable.getNum() == 32) && (MySequenceable.getString() == "nihao")){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeInterface(param: InterfaceDeclareProxy, callback : voidParameterTypeInterfaceCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3100 called"); - let proxy = new InterfaceDeclareProxy(param); - proxy.testInterface(3300, (errCode)=>{ - if (errCode == SUCCESS) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3100 callback SUCCESS"); - callback(SUCCESS); - } else { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3100 callback FAIL"); - callback(FAIL); - } - }); - - } - - voidParameterTypeMapStringString(map, callback : voidParameterTypeMapStringStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_3200 called:'+ map.get("voidParameterTypeMapStringString")); - if(map.get("voidParameterTypeMapStringString") == "fdhatdh"){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeDoubleArray(array, callback : voidParameterTypeDoubleArrayCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_3300 called:'+ JSON.stringify(array)); - if(array.length == 2 && array[0] == 1.1 && array[1] == 2.1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidOrderOutIn(paramI, callback: voidOrderOutInCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3400 called" + paramI); - var mystring = "hello world"; - callback(SUCCESS, mystring); - } - - voidOrderInOutIn(paramI, paramS, callback: voidOrderInOutInCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3500 called" + paramI + " " + paramS); - var mynumber = 6; - callback(SUCCESS, mynumber); - } - - voidOrderOutInOut(paramS, callback: voidOrderOutInOutCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3600 called" + paramS); - var mynumber = 3; - var mystring = "paramcallback"; - callback(SUCCESS, mynumber, mystring); - } - - voidOrderInInOutOut(paramS, paramI, callback: voidOrderInInOutOutCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3700 called" + paramS + " " + paramI); - var mystring = "callback"; - var mynumber = 4; - callback(SUCCESS, mynumber, mystring); - } -} - -export default class ServiceAbility extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ZidlClientTest ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ZidlClientTest ServiceAbility onRequest, want: ' + want.abilityName - + ', startId: ' + startId); - } - - onConnect(want) { - console.log('ZidlClientTest ServiceAbility onConnect, want:' + want.abilityName); - return new ZidlTestImp('connect'); - } - - onDisconnect(want) { - console.log('ZidlClientTest ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ZidlClientTest ServiceAbility onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts deleted file mode 100755 index 9c6b544fcf622de7f85f5301f307857f855f2ec6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts +++ /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. - */ - - -export default interface IInterfaceDeclare { - testInterface(data: number, callback: testInterfaceCallback): void; -} -export type testInterfaceCallback = (errCode: number) => void; - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts deleted file mode 100755 index fadb691def524f2745a670d6c4c9cfbb4fffd475..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts +++ /dev/null @@ -1,44 +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 {testInterfaceCallback} from "./i_interface_declare"; -import IInterfaceDeclare from "./i_interface_declare"; -import rpc from "@ohos.rpc"; - -export default class InterfaceDeclareProxy implements IInterfaceDeclare { - constructor(proxy) { - this.proxy = proxy; - } - - testInterface(data: number, callback: testInterfaceCallback): void - { - let _option = new rpc.MessageOption(rpc.MessageOption.TF_SYNC); - let _data = new rpc.MessageParcel(); - let _reply = new rpc.MessageParcel(); - _data.writeInt(data); - this.proxy.sendRequest(InterfaceDeclareProxy.COMMAND_TEST_INTERFACE, _data, _reply, _option).then(function(result) { - if (result.errCode === 0) { - let _errCode = result.reply.readInt(); - callback(_errCode); - } else { - console.log("sendRequest failed, errCode: " + result.errCode); - } - }) - } - - static readonly COMMAND_TEST_INTERFACE = 1; - private proxy -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts deleted file mode 100755 index fa6208b1f94fc17dd376c3495e9ceea3c317ee0b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts +++ /dev/null @@ -1,47 +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 {testInterfaceCallback} from "./i_interface_declare"; -import IInterfaceDeclare from "./i_interface_declare"; -import rpc from "@ohos.rpc"; - -export default class InterfaceDeclareStub extends rpc.RemoteObject implements IInterfaceDeclare { - constructor(des: string) { - super(des); - } - - onRemoteRequest(code: number, data, reply, option): boolean { - console.log("onRemoteRequest called, code = " + code); - switch(code) { - case InterfaceDeclareStub.COMMAND_TEST_INTERFACE: { - let _data = data.readInt(); - this.testInterface(_data, (errCode) => { - reply.writeInt(errCode); - }); - return true; - } - default: { - console.log("invalid request code" + code); - break; - } - } - return false; - } - - testInterface(data: number, callback: testInterfaceCallback): void{} - - static readonly COMMAND_TEST_INTERFACE = 1; -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts deleted file mode 100755 index 0030fa8fefb9f88efbb1cbefa804919da4499cc2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default class MySequenceable { - constructor() { - this.num = 14; - this.str = "hello"; - } - getNum() : number { - return this.num; - } - - getString() : string { - return this.str; - } - - marshalling(messageParcel) { - console.info('marshalling++++'); - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - return true; - } - unmarshalling(messageParcel) { - console.info('unmarshalling++++'); - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - return true; - } - private num; - private str; -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100755 index 3f6957e65b120da38469d647448653046b29112a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,64 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -import ZidlTestServiceStubOneway from './zidlToolOneWay/interface_attribute_declaratoin_oneway_stub'; -import {voidVoidFirstCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' -import {voidVoidSecondCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' -import {voidVoidThirdCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' - -const SUCCESS = 0; -const FAIL = 1; - -class ZidlTestImpOneway extends ZidlTestServiceStubOneway { - voidVoidFirst(callback: voidVoidFirstCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0100_1 called"); - callback(SUCCESS); - } - - voidVoidSecond(callback: voidVoidSecondCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0100_2 called"); - callback(SUCCESS); - } - - voidVoidThird(callback: voidVoidThirdCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0100_3 called"); - callback(SUCCESS); - } -} - -export default class ServiceAbility2 extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ZidlClientTest ServiceAbility2 onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ZidlClientTest ServiceAbility2 onRequest, want: ' + want.abilityName - + ', startId: ' + startId); - } - - onConnect(want) { - console.log('ZidlClientTest ServiceAbility2 onConnect, want:' + want.abilityName); - return new ZidlTestImpOneway('connect'); - } - - onDisconnect(want) { - console.log('ZidlClientTest ServiceAbility2 onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('ZidlClientTest ServiceAbility2 onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts deleted file mode 100755 index 943d83dc857cd02cccbddfd143c4b3e504ebf825..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts +++ /dev/null @@ -1,25 +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. - */ - - -export default interface IInterfaceAttributeDeclaratoinOneway { - voidVoidFirst(callback: voidVoidFirstCallback): void; - voidVoidSecond(callback: voidVoidSecondCallback): void; - voidVoidThird(callback: voidVoidThirdCallback): void; -} -export type voidVoidFirstCallback = (errCode: number) => void; -export type voidVoidSecondCallback = (errCode: number) => void; -export type voidVoidThirdCallback = (errCode: number) => void; - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts deleted file mode 100755 index a2b75c5f4d97885876f91ef457802e77e20914e2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts +++ /dev/null @@ -1,64 +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 {voidVoidFirstCallback} from "./i_interface_attribute_declaratoin_oneway"; -import {voidVoidSecondCallback} from "./i_interface_attribute_declaratoin_oneway"; -import {voidVoidThirdCallback} from "./i_interface_attribute_declaratoin_oneway"; -import IInterfaceAttributeDeclaratoinOneway from "./i_interface_attribute_declaratoin_oneway"; -import rpc from "@ohos.rpc"; - -export default class InterfaceAttributeDeclaratoinOnewayStub extends rpc.RemoteObject implements IInterfaceAttributeDeclaratoinOneway { - constructor(des: string) { - super(des); - } - - onRemoteRequest(code: number, data, reply, option): boolean { - console.log("onRemoteRequest called, code = " + code); - switch(code) { - case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_FIRST: { - this.voidVoidFirst((errCode) => { - reply.writeInt(errCode); - }); - return true; - } - case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_SECOND: { - this.voidVoidSecond((errCode) => { - reply.writeInt(errCode); - }); - return true; - } - case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_THIRD: { - this.voidVoidThird((errCode) => { - reply.writeInt(errCode); - }); - return true; - } - default: { - console.log("invalid request code" + code); - break; - } - } - return false; - } - - voidVoidFirst(callback: voidVoidFirstCallback): void{} - voidVoidSecond(callback: voidVoidSecondCallback): void{} - voidVoidThird(callback: voidVoidThirdCallback): void{} - - static readonly COMMAND_VOID_VOID_FIRST = 1; - static readonly COMMAND_VOID_VOID_SECOND = 2; - static readonly COMMAND_VOID_VOID_THIRD = 3; -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/i_interface_declare.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/i_interface_declare.ts deleted file mode 100755 index 9c6b544fcf622de7f85f5301f307857f855f2ec6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/i_interface_declare.ts +++ /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. - */ - - -export default interface IInterfaceDeclare { - testInterface(data: number, callback: testInterfaceCallback): void; -} -export type testInterfaceCallback = (errCode: number) => void; - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_proxy.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_proxy.ts deleted file mode 100755 index fadb691def524f2745a670d6c4c9cfbb4fffd475..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_proxy.ts +++ /dev/null @@ -1,44 +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 {testInterfaceCallback} from "./i_interface_declare"; -import IInterfaceDeclare from "./i_interface_declare"; -import rpc from "@ohos.rpc"; - -export default class InterfaceDeclareProxy implements IInterfaceDeclare { - constructor(proxy) { - this.proxy = proxy; - } - - testInterface(data: number, callback: testInterfaceCallback): void - { - let _option = new rpc.MessageOption(rpc.MessageOption.TF_SYNC); - let _data = new rpc.MessageParcel(); - let _reply = new rpc.MessageParcel(); - _data.writeInt(data); - this.proxy.sendRequest(InterfaceDeclareProxy.COMMAND_TEST_INTERFACE, _data, _reply, _option).then(function(result) { - if (result.errCode === 0) { - let _errCode = result.reply.readInt(); - callback(_errCode); - } else { - console.log("sendRequest failed, errCode: " + result.errCode); - } - }) - } - - static readonly COMMAND_TEST_INTERFACE = 1; - private proxy -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_stub.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_stub.ts deleted file mode 100755 index fa6208b1f94fc17dd376c3495e9ceea3c317ee0b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_stub.ts +++ /dev/null @@ -1,47 +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 {testInterfaceCallback} from "./i_interface_declare"; -import IInterfaceDeclare from "./i_interface_declare"; -import rpc from "@ohos.rpc"; - -export default class InterfaceDeclareStub extends rpc.RemoteObject implements IInterfaceDeclare { - constructor(des: string) { - super(des); - } - - onRemoteRequest(code: number, data, reply, option): boolean { - console.log("onRemoteRequest called, code = " + code); - switch(code) { - case InterfaceDeclareStub.COMMAND_TEST_INTERFACE: { - let _data = data.readInt(); - this.testInterface(_data, (errCode) => { - reply.writeInt(errCode); - }); - return true; - } - default: { - console.log("invalid request code" + code); - break; - } - } - return false; - } - - testInterface(data: number, callback: testInterfaceCallback): void{} - - static readonly COMMAND_TEST_INTERFACE = 1; -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index.ets b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index.ets deleted file mode 100755 index e5ef3e3680a267a6aa28a510c77f04cc5cd3c0cb..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index.ets +++ /dev/null @@ -1,64 +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.ets" -import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters['timeout'] = 10000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Test App') - .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/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 577f53879917d26276c6ef294f65d9d044533161..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,66 +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.ets" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/my_sequenceable.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/my_sequenceable.ts deleted file mode 100755 index 7cd93c0ecc3403e8e3e8a40c1392e4a0e025b169..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/my_sequenceable.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default class MySequenceable { - constructor() { - this.num = 32; - this.str = "nihao"; - } - getNum() : number { - return this.num; - } - - getString() : string { - return this.str; - } - - marshalling(messageParcel) { - console.info('marshalling++++'); - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - return true; - } - unmarshalling(messageParcel) { - console.info('unmarshalling++++'); - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - return true; - } - private num; - private str; -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts b/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts deleted file mode 100755 index 943d83dc857cd02cccbddfd143c4b3e504ebf825..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts +++ /dev/null @@ -1,25 +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. - */ - - -export default interface IInterfaceAttributeDeclaratoinOneway { - voidVoidFirst(callback: voidVoidFirstCallback): void; - voidVoidSecond(callback: voidVoidSecondCallback): void; - voidVoidThird(callback: voidVoidThirdCallback): void; -} -export type voidVoidFirstCallback = (errCode: number) => void; -export type voidVoidSecondCallback = (errCode: number) => void; -export type voidVoidThirdCallback = (errCode: number) => void; - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/app.json b/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/app.json deleted file mode 100755 index 6fb3b00113b6a44a209002cc861e335dad5f197b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.zidlservice", - "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/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/resources/base/element/string.json deleted file mode 100755 index 0d3507c0d180557b94bc5f0071ba146b4909fe51..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/Test.json b/aafwk/aafwk_standard/zidltest/actsamszidlservice/Test.json deleted file mode 100755 index 3ec911dfc7b3a17504cd4577be5bbabaf7f97e63..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/Test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests" -} diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100755 index 159f48742031f407af4b1016035bf01e8e12a10a..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/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.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100755 index 7bbcfae1558870546b771fab5ab5ca1c4511a9d0..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,51 +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("ACTS_ProcessManage VendorAppService MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("ACTS_ProcessManage VendorAppService MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index", null) - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageDestroy") - } - - async onForeground() { - // Ability has brought to foreground - console.log("ACTS_ProcessManage VendorAppService MainAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("ACTS_ProcessManage VendorAppService MainAbility onBackground") - } -}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/ServiceAbility.ts deleted file mode 100755 index 19dbaec3be48cecc39e3f115abd3f1f5baa88018..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ /dev/null @@ -1,433 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -import {voidOutStringCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOutIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutIntCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidInOutStringCallback} from "./zidlTool/i_zidl_tool_test"; -import {booleanVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {byteVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {shortVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {intVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {longVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {floatVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {doubleVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {stringVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {sequenceableVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {interfaceVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {mapStringStringVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {doubleArrayVoidCallback} from "./zidlTool/i_zidl_tool_test"; -import {voidOrderOutInCallback} from "./zidlTool/i_zidl_tool_test" -import {voidOrderInOutInCallback} from "./zidlTool/i_zidl_tool_test" -import {voidOrderOutInOutCallback} from "./zidlTool/i_zidl_tool_test" -import {voidOrderInInOutOutCallback} from "./zidlTool/i_zidl_tool_test" -import {onewayVoidVoidCallback} from "./zidlTool/i_zidl_tool_test" -import {voidInMapStringIntCallback} from "./zidlTool/i_zidl_tool_test" -import {voidVoidCallback} from "./zidlTool/i_zidl_tool_test" -import {voidInStringArrayCallback} from "./zidlTool/i_zidl_tool_test" -import ZidlTestServiceStub from './zidlTool/zidl_tool_test_stub'; -import MySequenceable from "./zidlTool/my_sequenceable"; -import InterfaceDeclareProxy from './interfaceDeclare/interface_declare_proxy' -import InterfaceDeclareStub from './interfaceDeclare/interface_declare_stub' -import {voidInIntCallback} from "./zidlTool/i_zidl_tool_test" -import {voidInStringCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeBooleanCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeByteCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeShortCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeIntCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeLongCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeFloatCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeDoubleCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeStringCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeSequenceableCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeInterfaceCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeMapStringStringCallback} from "./zidlTool/i_zidl_tool_test" -import {voidParameterTypeDoubleArrayCallback} from "./zidlTool/i_zidl_tool_test" -import {testInterfaceCallback} from './interfaceDeclare/i_interface_declare' - -var SUCCESS = 0; -var FAIL = 1; - -class ZidlTestImp extends ZidlTestServiceStub { - - onewayVoidVoid(callback: onewayVoidVoidCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0200 called"); - callback(SUCCESS); - } - - voidVoid(callback: voidVoidCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0300 called"); - callback(SUCCESS); - } - - booleanVoid(callback: booleanVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0400 called"); - var boolean = true; - callback(SUCCESS, boolean); - } - - byteVoid(callback: byteVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0500 called"); - var mybyte = 1; - callback(SUCCESS, mybyte); - } - - shortVoid(callback: shortVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0600 called"); - var myshort = 222; - callback(SUCCESS, myshort); - } - - intVoid(callback: intVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0700 called"); - var myint = 333; - callback(SUCCESS, myint); - } - - longVoid(callback: longVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0800 called"); - var mylong = 4444; - callback(SUCCESS, mylong); - } - - floatVoid(callback: floatVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0900 called"); - var myfloat = 10.1; - callback(SUCCESS, myfloat); - } - - doubleVoid(callback: doubleVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1000 called"); - var mydouble = 22.1; - callback(SUCCESS, mydouble); - } - - stringVoid(callback: stringVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1100 called"); - var mystring = "stringVoid"; - callback(SUCCESS, mystring); - } - - sequenceableVoid(callback: sequenceableVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1200 called"); - let mySequence = new MySequenceable(); - callback(SUCCESS, mySequence); - } - - interfaceVoid(callback: interfaceVoidCallback) { - class InterfaceDeclare extends InterfaceDeclareStub { - testInterface(data: number, callback: testInterfaceCallback): void{ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1300 interfaceStub called"); - let result = FAIL; - - if (data == 1500) { - result = SUCCESS; - } - callback(result); - } - } - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1300 toolStub called"); - let serverInterface = new InterfaceDeclare('serverInterface'); - callback(SUCCESS, serverInterface); - } - - mapStringStringVoid(callback: mapStringStringVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1400 called"); - let myMap = new Map(); - myMap.set("string1","string2"); - callback(SUCCESS, myMap); - } - - doubleArrayVoid(callback: doubleArrayVoidCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1500 called"); - var array = [1.1, 2.1, 3.1]; - callback(SUCCESS, array); - } - - voidInMapStringInt(myMap, callback: voidInMapStringIntCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1600_1 called:'+ myMap.get("string1")); - if(myMap.get("string1") == 1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidInStringArray(strarray, callback: voidInStringArrayCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1600_2 called:"+ JSON.stringify(strarray)); - if(strarray[0] == "aaa"&&strarray[1] == "bbb"&&strarray[2] == "ccc"){ - callback(SUCCESS); - }else { - callback(FAIL); - } - } - - voidOutMapStringInt(callback : voidOutMapStringIntCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1700 called'); - var map=new Map(); - map.set("voidOutMapStringInt", 1); - callback(SUCCESS, map); - } - - voidOutStringArray(callback :voidOutStringArrayCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1700 called'); - var strarray = ["aa", "dd"]; - callback(SUCCESS, strarray); - } - - voidInOutMapStringInt(mapIn, callback: voidInOutMapStringIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1800 called'); - var errCode = FAIL; - if ((mapIn.get("voidInOutMapStringInt1") == 1801) && - (mapIn.get("voidInOutMapStringInt2") == 1802)) { - mapIn.set("voidInOutMapStringInt1", 1802); - mapIn.set("voidInOutMapStringInt2", 1801); - errCode = SUCCESS; - } - callback(errCode, mapIn); - } - - voidInOutStringArray(strArrayIn, callback: voidInOutStringArrayCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1800 called'); - var errCode = FAIL; - if ((strArrayIn[0] == "ddd") && - (strArrayIn[1] == "ccc")) { - strArrayIn[0] = "aaa"; - strArrayIn[1] = "bbb"; - errCode = SUCCESS; - } - callback(errCode, strArrayIn); - } - - voidInInt(number, callback : voidInIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1900 called:'+ JSON.stringify(number)); - if(number == 8888){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidInString(string, callback : voidInStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1900 called:'+ JSON.stringify(string)); - if(string == "voidInString"){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidOutInt(callback : voidOutIntCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2000 called'); - var number = 123; - callback(SUCCESS, number); - } - - voidOutString(callback : voidOutStringCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2000 called'); - var string = "voidOutString"; - callback(SUCCESS, string); - } - - voidInOutInt(number, callback: voidInOutIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_1 called:'+ JSON.stringify(number)); - var num = 456789; - if(number == 123456){ - callback(SUCCESS, num); - }else{ - callback(FAIL, number); - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_1 Call_Fail') - } - } - voidInOutString(strinput, callback: voidInOutStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_2 called:'+ JSON.stringify(strinput)); - var str = "456789"; - if(strinput == "voidInOutString"){ - callback(SUCCESS, str); - }else{ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_2 Call_Fail'); - callback(FAIL, strinput); - } - } - - voidParameterTypeBoolean(oBooleanTrue, callback : voidParameterTypeBooleanCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2200 called:'+ JSON.stringify(oBooleanTrue)); - if(oBooleanTrue == true){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeByte(number, callback : voidParameterTypeByteCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2300 called:'+ JSON.stringify(number)); - if(number == 1111){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeShort(number, callback : voidParameterTypeShortCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2400 called:'+ JSON.stringify(number)); - if(number == 2222){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeInt(number, callback : voidParameterTypeIntCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2500 called:'+ JSON.stringify(number)); - if(number == 3333){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeLong(number, callback : voidParameterTypeLongCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2600 called:'+ JSON.stringify(number)); - if(number == 4444){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeFloat(number, callback : voidParameterTypeFloatCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2700 called:'+ JSON.stringify(number)); - if(number == 5555.1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeDouble(number, callback : voidParameterTypeDoubleCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2800 called:'+ JSON.stringify(number)); - if(number == 6666.1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeString(string, callback : voidParameterTypeStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2900 called:'+ JSON.stringify(string)); - if(string == "voidParameterTypeString"){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeSequenceable(MySequenceable, callback : voidParameterTypeSequenceableCallback) { - console.log('ZidlTest Process Server ACTS_Zidl_Js2JsMulti_3000 called:'+ JSON.stringify(MySequenceable)); - if((MySequenceable != null) && (MySequenceable.getNum() == 32) && (MySequenceable.getString() == "nihao")){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeInterface(param: InterfaceDeclareProxy, callback : voidParameterTypeInterfaceCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3100 called"); - let proxy = new InterfaceDeclareProxy(param); - proxy.testInterface(3300, (errCode)=>{ - if (errCode == SUCCESS) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3100 callback SUCCESS"); - callback(SUCCESS); - } else { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3100 callback FAIL"); - callback(FAIL); - } - }); - - } - - voidParameterTypeMapStringString(map, callback : voidParameterTypeMapStringStringCallback) { - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_3200 called:'+ map.get("voidParameterTypeMapStringString")); - if(map.get("voidParameterTypeMapStringString") == "fdhatdh"){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidParameterTypeDoubleArray(array, callback : voidParameterTypeDoubleArrayCallback){ - console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_3300 called:'+ JSON.stringify(array)); - if(array.length == 2 && array[0] == 1.1 && array[1] == 2.1){ - callback(SUCCESS); - }else{ - callback(FAIL); - } - } - - voidOrderOutIn(paramI, callback: voidOrderOutInCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3400 called" + paramI); - var mystring = "hello world"; - callback(SUCCESS, mystring); - } - - voidOrderInOutIn(paramI, paramS, callback: voidOrderInOutInCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3500 called" + paramI + " " + paramS); - var mynumber = 6; - callback(SUCCESS, mynumber); - } - - voidOrderOutInOut(paramS, callback: voidOrderOutInOutCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3600 called" + paramS); - var mynumber = 3; - var mystring = "paramcallback"; - callback(SUCCESS, mynumber, mystring); - } - - voidOrderInInOutOut(paramS, paramI, callback: voidOrderInInOutOutCallback){ - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3700 called" + paramS + " " + paramI); - var mystring = "callback"; - var mynumber = 4; - callback(SUCCESS, mynumber, mystring); - } -} - -export default class ServiceAbility extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ZidlService ServiceAbility onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ZidlService ServiceAbility onRequest, want: ' + want.abilityName - + ', startId: ' + startId); - } - - onConnect(want) { - console.log('ZidlService ServiceAbility onConnect, want:' + want.abilityName); - return new ZidlTestImp('connect'); - } - - onDisconnect(want) { - console.log('ZidlService ServiceAbility onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('AZidlService ServiceAbility onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts deleted file mode 100755 index 9c6b544fcf622de7f85f5301f307857f855f2ec6..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts +++ /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. - */ - - -export default interface IInterfaceDeclare { - testInterface(data: number, callback: testInterfaceCallback): void; -} -export type testInterfaceCallback = (errCode: number) => void; - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts deleted file mode 100755 index fadb691def524f2745a670d6c4c9cfbb4fffd475..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts +++ /dev/null @@ -1,44 +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 {testInterfaceCallback} from "./i_interface_declare"; -import IInterfaceDeclare from "./i_interface_declare"; -import rpc from "@ohos.rpc"; - -export default class InterfaceDeclareProxy implements IInterfaceDeclare { - constructor(proxy) { - this.proxy = proxy; - } - - testInterface(data: number, callback: testInterfaceCallback): void - { - let _option = new rpc.MessageOption(rpc.MessageOption.TF_SYNC); - let _data = new rpc.MessageParcel(); - let _reply = new rpc.MessageParcel(); - _data.writeInt(data); - this.proxy.sendRequest(InterfaceDeclareProxy.COMMAND_TEST_INTERFACE, _data, _reply, _option).then(function(result) { - if (result.errCode === 0) { - let _errCode = result.reply.readInt(); - callback(_errCode); - } else { - console.log("sendRequest failed, errCode: " + result.errCode); - } - }) - } - - static readonly COMMAND_TEST_INTERFACE = 1; - private proxy -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts deleted file mode 100755 index fa6208b1f94fc17dd376c3495e9ceea3c317ee0b..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts +++ /dev/null @@ -1,47 +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 {testInterfaceCallback} from "./i_interface_declare"; -import IInterfaceDeclare from "./i_interface_declare"; -import rpc from "@ohos.rpc"; - -export default class InterfaceDeclareStub extends rpc.RemoteObject implements IInterfaceDeclare { - constructor(des: string) { - super(des); - } - - onRemoteRequest(code: number, data, reply, option): boolean { - console.log("onRemoteRequest called, code = " + code); - switch(code) { - case InterfaceDeclareStub.COMMAND_TEST_INTERFACE: { - let _data = data.readInt(); - this.testInterface(_data, (errCode) => { - reply.writeInt(errCode); - }); - return true; - } - default: { - console.log("invalid request code" + code); - break; - } - } - return false; - } - - testInterface(data: number, callback: testInterfaceCallback): void{} - - static readonly COMMAND_TEST_INTERFACE = 1; -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts deleted file mode 100755 index 0030fa8fefb9f88efbb1cbefa804919da4499cc2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default class MySequenceable { - constructor() { - this.num = 14; - this.str = "hello"; - } - getNum() : number { - return this.num; - } - - getString() : string { - return this.str; - } - - marshalling(messageParcel) { - console.info('marshalling++++'); - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - return true; - } - unmarshalling(messageParcel) { - console.info('unmarshalling++++'); - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - return true; - } - private num; - private str; -} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts deleted file mode 100755 index 79f54ac14eeb5a62fc54b4e4cec2eee5c53d5c75..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts +++ /dev/null @@ -1,64 +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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' -import ZidlTestServiceStubOneway from './zidlToolOneWay/interface_attribute_declaratoin_oneway_stub'; -import {voidVoidFirstCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' -import {voidVoidSecondCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' -import {voidVoidThirdCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' - -const SUCCESS = 0; -const FAIL = 1; - -class ZidlTestImpOneway extends ZidlTestServiceStubOneway { - voidVoidFirst(callback: voidVoidFirstCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0100_1 called"); - callback(SUCCESS); - } - - voidVoidSecond(callback: voidVoidSecondCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0100_2 called"); - callback(SUCCESS); - } - - voidVoidThird(callback: voidVoidThirdCallback) { - console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0100_3 called"); - callback(SUCCESS); - } -} - -export default class ServiceAbility2 extends ServiceExtension { - onCreate(want,startId) { - globalThis.abilityWant = want; - console.log('ZidlService ServiceAbility2 onCreate, want: ' + want.abilityName); - } - - onRequest(want, startId) { - console.log('ZidlService ServiceAbility2 onRequest, want: ' + want.abilityName - + ', startId: ' + startId); - } - - onConnect(want) { - console.log('ZidlService ServiceAbility2 onConnect, want:' + want.abilityName); - return new ZidlTestImpOneway('connect'); - } - - onDisconnect(want) { - console.log('ZidlService ServiceAbility2 onDisconnect, want:' + want.abilityName); - } - - onDestroy() { - console.log('AZidlService ServiceAbility2 onDestroy'); - } -}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts deleted file mode 100755 index 943d83dc857cd02cccbddfd143c4b3e504ebf825..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts +++ /dev/null @@ -1,25 +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. - */ - - -export default interface IInterfaceAttributeDeclaratoinOneway { - voidVoidFirst(callback: voidVoidFirstCallback): void; - voidVoidSecond(callback: voidVoidSecondCallback): void; - voidVoidThird(callback: voidVoidThirdCallback): void; -} -export type voidVoidFirstCallback = (errCode: number) => void; -export type voidVoidSecondCallback = (errCode: number) => void; -export type voidVoidThirdCallback = (errCode: number) => void; - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts deleted file mode 100755 index a2b75c5f4d97885876f91ef457802e77e20914e2..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts +++ /dev/null @@ -1,64 +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 {voidVoidFirstCallback} from "./i_interface_attribute_declaratoin_oneway"; -import {voidVoidSecondCallback} from "./i_interface_attribute_declaratoin_oneway"; -import {voidVoidThirdCallback} from "./i_interface_attribute_declaratoin_oneway"; -import IInterfaceAttributeDeclaratoinOneway from "./i_interface_attribute_declaratoin_oneway"; -import rpc from "@ohos.rpc"; - -export default class InterfaceAttributeDeclaratoinOnewayStub extends rpc.RemoteObject implements IInterfaceAttributeDeclaratoinOneway { - constructor(des: string) { - super(des); - } - - onRemoteRequest(code: number, data, reply, option): boolean { - console.log("onRemoteRequest called, code = " + code); - switch(code) { - case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_FIRST: { - this.voidVoidFirst((errCode) => { - reply.writeInt(errCode); - }); - return true; - } - case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_SECOND: { - this.voidVoidSecond((errCode) => { - reply.writeInt(errCode); - }); - return true; - } - case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_THIRD: { - this.voidVoidThird((errCode) => { - reply.writeInt(errCode); - }); - return true; - } - default: { - console.log("invalid request code" + code); - break; - } - } - return false; - } - - voidVoidFirst(callback: voidVoidFirstCallback): void{} - voidVoidSecond(callback: voidVoidSecondCallback): void{} - voidVoidThird(callback: voidVoidThirdCallback): void{} - - static readonly COMMAND_VOID_VOID_FIRST = 1; - static readonly COMMAND_VOID_VOID_SECOND = 2; - static readonly COMMAND_VOID_VOID_THIRD = 3; -} - diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/module.json b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/module.json deleted file mode 100755 index 40f140623e5cc80a03e81bf0cac2b923443daea4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/module.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.zidlservice.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/ServiceAbility/ServiceAbility.ts", - "name": "com.example.zidlservice.ServiceAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "visible": true - }, - { - "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", - "name": "com.example.zidlservice.ServiceAbility2", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "service", - "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.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "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/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/element/string.json deleted file mode 100755 index 376647878b379044fa3300dfa4662c98a4c3efbc..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/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/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100755 index 96b478210df9884592229ae2db6f6bb7f86c14f4..0000000000000000000000000000000000000000 --- a/aafwk/aafwk_standard/zidltest/actsamszidlservice/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/ability/BUILD.gn b/ability/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5a4809d95cf7d9afbe27125b3c07e02197cf8eaf --- /dev/null +++ b/ability/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") + +group("ability") { + testonly = true + if (is_standard_system) { + deps = [ "ability_runtime:ability_runtime" ] + } +} diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..eb85bc7449c18b986c47d7ff83c89ee92cd3326e --- /dev/null +++ b/ability/ability_runtime/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") + +group("ability_runtime") { + testonly = true + if (is_standard_system) { + deps = [ + "abilitymanager:actsabilitymanagertest", + "abilitymultiinstance:abilitymultiinstance", + "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", + "actsabilitylifecyclestatenew:ActsAbilityLifecycleStateNewTest", + "actsabilitymanageretstest:ActsAbilityManagerEtsTest", + "actscalltest:actscalltest", + "actsfwkdataaccessortest:dataability", + "actsserviceabilityclienttest:serviceability", + "actsstartcomponenttest:actsstartcomponenttest", + "actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest", + "actsusers:actsusers", + "amscontextualinforquery:amscontextualinforquery", + "amsdatauriutils:ActsAmsDataUriUtilsTest", + "amsdisplayIdtest:amsdisplayIdtest", + "amsgetabilityprocessinfo:amsgetabilityprocessinfo", + "context:context", + "fa:fa", + "featureability:featureability", + "formmanager:formmanager", + "killprocesswithaccountstage:killprocesswithaccountstage", + "newwant:newwant", + "non_concurrent:non_concurrent", + "processmultiinstance:processmultiinstance", + "stage:stage", + "want:want", + #"zidltest:zidltest", + ] + } +} diff --git a/aafwk/aafwk_standard/abilitymanager/BUILD.gn b/ability/ability_runtime/abilitymanager/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/BUILD.gn rename to ability/ability_runtime/abilitymanager/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7df3196c86f21ef950a1bb3607520e8a96d198d2 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json @@ -0,0 +1,83 @@ +{ + "app": { + "bundleName": "com.example.actsamscallbackfifthscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamscallbackfifthscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamscallbackfifthscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.MANAGE_MISSIONS", + "reason":"need use ohos.permission.MANAGE_MISSIONS" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..27b7481c8e06acb037bead27db497d9e793bc83d --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,144 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +let abilityNameList = [ + "com.ohos.launcher.MainAbility", + "com.ohos.callui.ServiceAbility", + "com.example.SimulateFeatureAbilityFir", + "com.example.VerifyIoThirdAbility", + "com.example.SimulateFeatureAbilitySed", + "com.example.actsamscallbackfifthscene.MainAbility" +] + +let bundleNameList = [ + "com.ohos.launcher", + "com.ohos.systemui", + "com.ohos.callui", + "com.ohos.contacts", + "com.ohos.mms", + "com.ohos.telephonydataability", + "com.ohos.contactsdataability", + "com.ix.simulate.feature", + "com.ix.verify.io", + "com.example.actsamscallbackfifthscene" +] + +describe('ActsAmsCallBackFifthScene', function () { + console.info('----ActsAmsCallBackFifthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilitySed", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + setTimeout(done, 5000); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_6600 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_6600', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + } + ); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7cf34a5c9138c8a8b27dc5d4e577b33587f8905d --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamscallbackfirstscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamscallbackfirstscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamscallbackfirstscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bfc3c92aa28c10754088e302b49520e0fc1cf618 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,87 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' + +describe('ActsAmsCallBackFirstScene', function () { + console.info('----ActsAmsCallBackFirstScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_0200 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_0200', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b9d71249358ebf98d5ecb8677068bf2126859779 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamscallbackfourthscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamscallbackfourthscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamscallbackfourthscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0adfdff8c339d190b7d3fa7edc468969feff72d9 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsAmsCallBackFourthScene', function () { + console.info('----ActsAmsCallBackFourthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.act", + abilityName: "com.example.VerifyActThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.entry", + abilityName: "com.example.SimulateEntryAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_5000 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_5000', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..97db2e34824ae6fe1eeba98f7bb182217726d375 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' + +describe('ActsAmsCallBackSecondScene', function () { + console.info('----ActsAmsCallBackSecondScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_1800 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_1800', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e1ae6f5d9c472ec59da1ae2b78a3314e331926a5 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamscallbackthirdscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamscallbackthirdscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamscallbackthirdscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..fe25d2e6dd6ae2ee5253c6569dd604c1853cdce4 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsAmsCallBackThirdScene', function () { + console.info('----ActsAmsCallBackThirdScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_3400 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_3400', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..cba2279aca6cfa9b5f13825242a7dbf771a52118 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamstestfifthscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamstestfifthscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamstestfifthscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..fd889cd019c5043941c9a8975bde3b5aa0bb1092 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +let abilityNameList = [ + "com.ohos.launcher.MainAbility", + "com.ohos.callui.ServiceAbility", + "com.example.SimulateFeatureAbilityFir", + "com.example.SimulateFeatureAbilitySed", + "com.example.VerifyIoThirdAbility", + "com.example.actsamstestfifthscene.MainAbility" +] + +let bundleNameList = [ + "com.ohos.launcher", + "com.ohos.systemui", + "com.ohos.callui", + "com.ohos.contacts", + "com.ohos.mms", + "com.ohos.telephonydataability", + "com.ohos.contactsdataability", + "com.ix.simulate.feature", + "com.ix.verify.io", + "com.example.actsamstestfifthscene" +] + +describe('ActsAmsTestFifthScene', function () { + console.info('----ActsAmsTestFifthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilitySed", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_0100 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_0100', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + let info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0aa9487ed498072bc9ad5296434c59c1e992d4d8 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json @@ -0,0 +1,96 @@ +{ + "app": { + "bundleName": "com.example.actsamstestfirstscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamstestfirstscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.example.actsamstestfirstscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5df9e464ebfbef5cae9b21a534ab842019f8a9fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsAmsTestFirstScene', function () { + console.info('----ActsAmsTestFirstScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_0100 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_0100', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b0f032e0fe4674ccc58e1706483c08ad9fd23118 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamstestfourthscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamstestfourthscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamstestfourthscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..009209ae9a20d45389f20bfe37cb17a19951aef2 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsAmsTestFourthScene', function () { + console.info('----ActsAmsTestFourthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.act", + abilityName: "com.example.VerifyActThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.entry", + abilityName: "com.example.SimulateEntryAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_1700 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_1700', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..70128f8ab2936d883531ec674175bcd0d6ca5950 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamstestsecondscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamstestsecondscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamstestsecondscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e90d26e448b692c576e90a51105c55850b0009bf --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsAmsTestSecondScene', function () { + console.info('----ActsAmsTestSecondScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_1700 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_1700', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/BUILD.gn rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..404bffd0fe34f5f9783b3cc0f7b8b650026f134e --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json @@ -0,0 +1,87 @@ +{ + "app": { + "bundleName": "com.example.actsamstestthirdscene", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamstestthirdscene", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamstestthirdscene.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "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" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..570a85fe0df63cc9cf5bbf4584cdbd210e5e4d65 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsAmsTestThirdScene', function () { + console.info('----ActsAmsTestThirdScene----'); + + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_3300 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_3300', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info)); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i])); + expect(typeof (info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof (info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + expect(Array.isArray(info[i].bundleNames)).assertEqual(true); + expect(info[i].bundleNames.length).assertEqual(0); + + expect(typeof (info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + } + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/BUILD.gn b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/BUILD.gn rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/Test.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/Test.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/Test.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..de20a4362f25370f1e4cfccc2e5469d102ede3d5 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json @@ -0,0 +1,74 @@ +{ + "app": { + "bundleName": "com.ix.simulate.entry", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.simulateeability", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "simulateEAbility", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SimulateEntryAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/BUILD.gn b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/BUILD.gn rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/Test.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/Test.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/Test.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b5b8e428c62b3cdbc61c2d65cdbfe3ac45c516a3 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json @@ -0,0 +1,74 @@ +{ + "app": { + "bundleName": "com.ix.simulate.feature", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.simulatefabilityfir", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "simulateFAbilityFir", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SimulateFeatureAbilityFir", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/BUILD.gn b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/BUILD.gn rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/Test.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/Test.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/Test.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..52cca5948ec80701f2972868ea59f9c17ea02b9a --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json @@ -0,0 +1,74 @@ +{ + "app": { + "bundleName": "com.ix.simulate.feature", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.simulatefabilitysed", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "simulateFAbilitySed", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SimulateFeatureAbilitySed", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/BUILD.gn b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/BUILD.gn rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/Test.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/Test.json rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/Test.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..367fbe56ff60319a84ec93f1b4685f959931ed23 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json @@ -0,0 +1,74 @@ +{ + "app": { + "bundleName": "com.ix.verify.act", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.verifyaability", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "verifyAAbility", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.VerifyActThirdAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/BUILD.gn b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/BUILD.gn rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/Test.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/Test.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/Test.json rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/Test.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..82b3340659f1fa47a1ed9e3651f0760f261a3219 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json @@ -0,0 +1,74 @@ +{ + "app": { + "bundleName": "com.ix.verify.io", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.verifyiability", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "verifyIAbility", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.VerifyIoThirdAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/BUILD.gn diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/app.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6eeb4089825ed9a4142e37807015e693d983aa7c --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.amsabilitymultiinstanceappa", + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/BUILD.gn diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/Test.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/Test.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/Test.json diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2bd862c5000206a39c7b0950be968df15c807ff1 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,51 @@ +/* + * 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" + +const ONACCEPTWANT_KEY_NOTSET_ID = -1; +const ONACCEPTWANT_KEY_UNDEFINED_ID = -2; +var onAcceptWantCalledSeq; + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("AbilityMultiInstanceAppA MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } + + onAcceptWant(want) { + console.log("AbilityMultiInstanceAppA onAcceptWant called want:" + JSON.stringify(want)); + if ((want.parameters == undefined) || (want.parameters.startId == undefined)) { + console.log("AbilityMultiInstanceAppA specified param err"); + return; + } + + var abilityId = want.parameters.startId.toString(); + onAcceptWantCalledSeq = "onAcceptWantCalled"; + onAcceptWantCalledSeq += "Id"; + onAcceptWantCalledSeq += abilityId; + globalThis.onAcceptWantCalledSeq = onAcceptWantCalledSeq; + + if (want.parameters.startId == ONACCEPTWANT_KEY_NOTSET_ID) { + return; + } else if (want.parameters.startId == ONACCEPTWANT_KEY_UNDEFINED_ID) { + return undefined; + } + + globalThis.abilityWant = want; + console.log("AbilityMultiInstanceAppA set globalThis result :" + globalThis.onAcceptWantCalledSeq); + return abilityId; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b6bf1feb2841f48d623cce0c8f0b74bea5a123c --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,141 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; + +function publishCallBack() { + console.debug("====>Publish CallBack ====>"); +} + +async function startAbilityProcess(abilityContext, parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + case "StartE": + bundleName = "com.example.amsabilitymultiinstanceappe"; + abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + }, (error, data) => { + console.log('AppA startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "AppA:" + callBackSeq += globalThis.onAcceptWantCalledSeq; + callBackData += callBackSeq; + + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + + console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify(abilityWant)); + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + callBackSeq = ""; + globalThis.onAcceptWantCalledSeq = ""; + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + callBackSeq = ""; + globalThis.onAcceptWantCalledSeq = ""; + startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); + }); + } +} + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("AbilityMultiInstanceAppA onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceAppA onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceAppA onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceAppA onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceAppA onForeground") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceAppA onBackground") + } +}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2eb330f80879cf5576e42523fd33c776b7c5cb98 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json @@ -0,0 +1,80 @@ +{ + "module": { + "name": "com.example.amsabilitymultiinstanceappa", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.amsabilitymultiinstanceappa.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "specified", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappa/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/app.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3b4690d4ee538be78e37f2992724d1faf383e67b --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.amsabilitymultiinstanceappb", + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/BUILD.gn diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/Test.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/Test.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/Test.json diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..08dee12306de669ae4e52f53c5234d98461148f4 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ddc665609975d98314ada687c1500495a87cd860 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,137 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; + +function publishCallBack() { + console.debug("====>AbilityMultiInstanceAppB Publish CallBack ====>"); +} + +async function startAbilityProcess(abilityContext, parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + case "StartE": + bundleName = "com.example.amsabilitymultiinstanceappe"; + abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + }, (error, data) => { + console.log('AppB startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "AppB:" + callBackData += callBackSeq; + + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + console.log("AbilityMultiInstanceAppB onShowProcess") + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + callBackSeq = ""; + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + callBackSeq = ""; + startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); + }); + } +} + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("AbilityMultiInstanceAppB MainAbility onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceAppB MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceAppB MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceAppB MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceAppB MainAbility onForeground") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceAppB MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..59947d2cd26bc6812931955346af8c9d7171f76f --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json @@ -0,0 +1,80 @@ +{ + "module": { + "name": "com.example.amsabilitymultiinstanceappb", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.amsabilitymultiinstanceappb.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "standard", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappb/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/app.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4a929dae8502d95cc6d63e1833cda12c58996441 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.amsabilitymultiinstanceappc", + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/BUILD.gn diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/Test.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/Test.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/Test.json diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..08dee12306de669ae4e52f53c5234d98461148f4 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..7df7ebd16cef32818d0574edf0e21b324041afcc --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,135 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; + +function publishCallBack() { + console.debug("====>AbilityMultiInstanceAppC Publish CallBack ====>"); +} + +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "AppC:"; + callBackData += callBackSeq; + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + console.log("AbilityMultiInstanceAppC onShowProcess") + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); + }); + } + callBackSeq = ""; +} + +async function startAbilityProcess(abilityContext, parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + case "StartE": + bundleName = "com.example.amsabilitymultiinstanceappe"; + abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + }, (error, data) => { + console.log('AppC startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context + 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") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..cc9c505c9ec155b96ff3cb20f89d2b8baffeffec --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json @@ -0,0 +1,80 @@ +{ + "module": { + "name": "com.example.amsabilitymultiinstanceappc", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.amsabilitymultiinstanceappc.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "singleton", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappc/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/app.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..44433c774917da52f33d7d1ec568df27dda320e5 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.amsabilitymultiinstanceappd", + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/BUILD.gn diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/Test.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/Test.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/Test.json diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7e4a876d9b814236f19936f6a6053b32959b289 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,37 @@ +/* + * 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" + +var onAcceptWantCalledSeq; + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("AbilityMultiInstanceAppD MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } + + onAcceptWant(want) { + console.log("AbilityMultiInstanceAppD onAcceptWant called want:" + JSON.stringify(want)); + var abilityId = want.parameters.startId.toString(); + onAcceptWantCalledSeq = "onAcceptWantCalled"; + onAcceptWantCalledSeq += "Id"; + onAcceptWantCalledSeq += abilityId; + globalThis.onAcceptWantCalledSeq = onAcceptWantCalledSeq; + globalThis.abilityWant = want; + console.log("AbilityMultiInstanceAppD set globalThis result :" + globalThis.onAcceptWantCalledSeq); + return abilityId; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f95a8942109b81fee665259986b17a050ab37e96 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,137 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; +function publishCallBack() { + console.debug("====>AbilityMultiInstanceAppD Publish CallBack ====>"); +} +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "AppD:"; + callBackSeq += globalThis.onAcceptWantCalledSeq; + callBackData += callBackSeq; + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + + console.log("AbilityMultiInstanceAppD abilityWant = " + JSON.stringify(abilityWant)); + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); + }); + } + globalThis.onAcceptWantCalledSeq = ""; + callBackSeq = ""; +} + +async function startAbilityProcess(abilityContext, parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + case "StartE": + bundleName = "com.example.amsabilitymultiinstanceappe"; + abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + }, (error, data) => { + console.log('AppD startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("AbilityMultiInstanceAppD onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceAppD onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceAppD onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceAppD onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceAppD onForeground") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceAppD onBackground") + } +}; diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..297ab54825e044bbfd9cc009128801db0a537456 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,137 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; +function publishCallBack() { + console.debug("====>AbilityMultiInstanceAppD Sec Publish CallBack ====>"); +} +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "AppD:"; + callBackSeq += globalThis.onAcceptWantCalledSeq; + callBackData += callBackSeq; + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + + console.log("AbilityMultiInstanceAppD Sec abilityWant = " + JSON.stringify(abilityWant)); + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); + }); + } + globalThis.onAcceptWantCalledSeq = ""; + callBackSeq = ""; +} + +async function startAbilityProcess(abilityContext, parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + case "StartE": + bundleName = "com.example.amsabilitymultiinstanceappe"; + abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + }, (error, data) => { + console.log('AppD startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +export default class SecondAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("AbilityMultiInstanceAppD Sec onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceAppD Sec onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceAppD Sec onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceAppD Sec onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceAppD Sec onForeground") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceAppD Sec onBackground") + } +}; diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/ThirdAbility/ThirdAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b5c594f7121e780e71e51a92ba74a38a200e872 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/ThirdAbility/ThirdAbility.ts @@ -0,0 +1,133 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; +function publishCallBack() { + console.debug("====>AbilityMultiInstanceAppD Third Publish CallBack ====>"); +} +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "AppD:"; + callBackSeq += globalThis.onAcceptWantCalledSeq; + callBackData += callBackSeq; + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + + console.log("AbilityMultiInstanceAppD Third abilityWant = " + JSON.stringify(abilityWant)); + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + startAbilityProcess(globalThis.abilityContext, abilityWant.parameters); + }); + } + globalThis.onAcceptWantCalledSeq = ""; + callBackSeq = ""; +} + +async function startAbilityProcess(abilityContext, parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + }, (error, data) => { + console.log('AppD startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +export default class ThirdAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("AbilityMultiInstanceAppD Third onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceAppD Third onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceAppD Third onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceAppD Third onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceAppD Third onForeground") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceAppD Third onBackground") + } +}; diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..14d28d9b42e2ec310f2a1f3382183bc6b4183cd2 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json @@ -0,0 +1,120 @@ +{ + "module": { + "name": "com.example.amsabilitymultiinstanceappd", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.amsabilitymultiinstanceappd.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "specified", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "com.example.amsabilitymultiinstanceappd.SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "standard", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "com.example.amsabilitymultiinstanceappd.ThirdAbility", + "srcEntrance": "./ets/ThirdAbility/ThirdAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "singleton", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappd/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/BUILD.gn diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/app.js b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/app.js old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/app.js rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/en-US.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/zh-CN.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.css old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.hml old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4124d4cd65dff39a20a83de3ca3a23d5d98a7f41 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/default/pages/index/index.js @@ -0,0 +1,120 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import commonEvent from '@ohos.commonEvent' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +var callBackSeq = ""; + +function publishCallBack() { + console.debug("====>AbilityMultiInstanceAppB Publish CallBack ====>"); +} + +async function startAbilityProcess(parameters) { + let bundleName = "com.example.amsabilitymultiinstanceappa"; + let abilityName = "com.example.amsabilitymultiinstanceappa.MainAbility"; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "StartA1": + parameters.startId = 1; + break; + case "StartA2": + parameters.startId = 2; + break; + case "StartB": + bundleName = "com.example.amsabilitymultiinstanceappb"; + abilityName = "com.example.amsabilitymultiinstanceappb.MainAbility"; + break; + case "StartC": + bundleName = "com.example.amsabilitymultiinstanceappc"; + abilityName = "com.example.amsabilitymultiinstanceappc.MainAbility"; + break; + case "StartDMain1": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 1; + break; + case "StartDMain2": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.MainAbility"; + parameters.startId = 2; + break; + case "StartDSec": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.SecondAbility"; + break; + case "StartDThd": + bundleName = "com.example.amsabilitymultiinstanceappd"; + abilityName = "com.example.amsabilitymultiinstanceappd.ThirdAbility"; + break; + case "StartE": + bundleName = "com.example.amsabilitymultiinstanceappe"; + abilityName = "com.example.amsabilitymultiinstanceappe.MainAbility"; + break; + + default: + break; + } + parameters.nextStep = ++idx; + await featureAbility.startAbility({ + want: + { + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + } + }); +} + +async function onShowProcess() { + var abilityWant = await featureAbility.getWant(); + var callBackData = "AppE:"; + callBackData += callBackSeq; + var commonEventPublishData = { + data: callBackData, + parameters: abilityWant.parameters + }; + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, publishCallBack); + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + startAbilityProcess(abilityWant.parameters); + }); + } + callBackSeq = ""; +} + +export default { + data: { + title: "AbilityMultiInstanceAppE" + }, + onInit() { + this.title = "AbilityMultiInstanceAppE"; + callBackSeq += "onInit"; + }, + onShow() { + console.log('AbilityMultiInstanceAppE onShow start'); + callBackSeq += "onShow"; + onShowProcess(); + }, + onStart() { + console.log('AbilityMultiInstanceAppE onStart'); + }, + onStop() { + console.log('AbilityMultiInstanceAppE onStop'); + }, +} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/app.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/app.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/app.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/BUILD.gn b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/BUILD.gn rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/BUILD.gn diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/Test.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..ab88a5292e3899519ebc08b79d02bd83a7d98a02 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/Test.json @@ -0,0 +1,35 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "500000", + "package": "com.example.abilitymultiinstance", + "shell-timeout": "300000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsAbilityMultiinstanceTest.hap", + "ActsAmsAbilityMultiinstanceHapARelyHap.hap", + "ActsAmsAbilityMultiinstanceHapBRelyHap.hap", + "ActsAmsAbilityMultiinstanceHapCRelyHap.hap", + "ActsAmsAbilityMultiinstanceHapDRelyHap.hap", + "ActsAmsAbilityMultiinstanceHapERelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b3495d6f447ce798ad40e21676e40434f78ee68 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,64 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters['timeout'] = 10000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Test App') + .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/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/abilitymultiinstance/amsabilitymultiinstancetest/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/BUILD.gn b/ability/ability_runtime/actsabilitydelegatorcase/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/BUILD.gn rename to ability/ability_runtime/actsabilitydelegatorcase/BUILD.gn diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/Test.json b/ability/ability_runtime/actsabilitydelegatorcase/Test.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/Test.json rename to ability/ability_runtime/actsabilitydelegatorcase/Test.json diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/config.json b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/config.json rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/app.js b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/app.js rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/test/ActsAbilityDelegatorCaseTest.test.js b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/test/ActsAbilityDelegatorCaseTest.test.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/test/ActsAbilityDelegatorCaseTest.test.js rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/test/ActsAbilityDelegatorCaseTest.test.js diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/test/List.test.js b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/actsabilitydelegatorcase/signature/openharmony_sx.p7b b/ability/ability_runtime/actsabilitydelegatorcase/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsabilitydelegatorcase/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsabilitydelegatorcase/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/BUILD.gn b/ability/ability_runtime/actsabilitylifecyclestatenew/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/BUILD.gn rename to ability/ability_runtime/actsabilitylifecyclestatenew/BUILD.gn diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/Test.json b/ability/ability_runtime/actsabilitylifecyclestatenew/Test.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/Test.json rename to ability/ability_runtime/actsabilitylifecyclestatenew/Test.json diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/config.json b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/config.json rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/app.js b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/app.js rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/test/ActsAbilityLifecycleStateNewTest.test.js b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/test/ActsAbilityLifecycleStateNewTest.test.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/test/ActsAbilityLifecycleStateNewTest.test.js rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/test/ActsAbilityLifecycleStateNewTest.test.js diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/test/List.test.js b/ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/actsabilitylifecyclestatenew/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/actsabilitylifecyclestatenew/signature/openharmony_sx.p7b b/ability/ability_runtime/actsabilitylifecyclestatenew/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsabilitylifecyclestatenew/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsabilitylifecyclestatenew/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsabilitymanageretstest/BUILD.gn b/ability/ability_runtime/actsabilitymanageretstest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f46a00c09886d8c5863852d49f43b58ea86cbbd4 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/BUILD.gn @@ -0,0 +1,36 @@ +# 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("ActsAbilityManagerEtsTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_ets_assets", + ":hjs_demo_ets_resources", + ":hjs_demo_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAbilityManagerEtsTest" +} +ohos_js_assets("hjs_demo_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("hjs_demo_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("hjs_demo_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsabilitymanageretstest/Test.json b/ability/ability_runtime/actsabilitymanageretstest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7ee81847cff616195794b63032ad1a4130163274 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.ohos.acecollaboration", + "package-name": "com.ohos.acecollaboration", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAbilityManagerEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c41d04caf7d0887c48afbdddd94df9cbd315b655 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json @@ -0,0 +1,192 @@ +{ + "app": { + "bundleName": "com.ohos.acecollaboration", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.acecollaboration", + "name": ".MyApplication", + "srcPath": "", + "mainAbility": "com.ohos.acecollaboration.MainAbility", + "deviceType": [ + "phone" + ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + } + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "srcPath": "MainAbility", + "srcLanguage": "ets", + "name": "com.ohos.acecollaboration.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "srcPath": "MainAbility2", + "name": ".MainAbility2", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability2", + "formsEnabled": false, + "label": "$string:entry_MainAbility2", + "type": "page", + "launchType": "standard" + }, + { + "srcPath": "ServiceAbility", + "name": ".ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability", + "type": "service" + }, + { + "srcPath": "ServiceAbility2", + "name": ".ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability2", + "type": "service" + }, + { + "srcPath": "ServiceAbility3", + "name": ".ServiceAbility3", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability3", + "type": "service" + }, + { + "srcPath": "ServiceAbility4", + "name": ".ServiceAbility4", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability4", + "type": "service" + }, + { + "srcPath": "ServiceAbility5", + "name": ".ServiceAbility5", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability5", + "type": "service" + }, + { + "srcPath": "ServiceAbility6", + "name": ".ServiceAbility6", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability6", + "type": "service" + }, + { + "srcPath": "ServiceAbility7", + "name": ".ServiceAbility7", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_serviceability7", + "type": "service" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": "MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility2", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "name": "com.ohos.acecollaboration.DataAbilityShellProvider.PROVIDER" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc86a0485f5fa3d43dc0d7a7d858e3f41ed87304 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f4528c93718b2ab0d0e45619fe987b18a61d586 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,40 @@ +/** + * 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. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + 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') + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..1503232a7024bbced8a52b26449f056600b0f0bf --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts @@ -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 rpc from '@ohos.rpc'; + +class StubTest extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility op1:' + op1 + ' op2:' + op2); + } + return true; + } +} + +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + }, + onConnect(want) { + console.info('ServiceAbility onConnect'); + return new StubTest("test"); + }, + onDisConnect(want) { + console.info('ServiceAbility onDisConnect'); + }, +}; diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3c5e888497e748d7b1953bcbcbef23a6c0d0486 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts @@ -0,0 +1,132 @@ +/** + * 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 particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc' + +class StubTest2 extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility2 onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility2 op1:' + op1 + ' op2:' + op2); + } + return true; + } +} + +function getNowTime() { + return new Date().getTime(); +} + +function getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; +} + +async function sleep(time: any) { + var now = new Date(); + var exitTime = now.getTime() + time; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + break; + } + console.info(`sleep ${time} over...`); +} + +export default { + onStart() { + console.info('ServiceAbility2 onStart'); + }, + onStop() { + console.info('ServiceAbility2 onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility2 onCommand'); + let request = { + "bundleName": "com.ohos.acecollaboration", + "abilityName": "com.ohos.acecollaboration.ServiceAbility", + } + let options = { + onConnect: async function (element: any, proxy: any) { + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.deviceId : ' + + JSON.stringify(element.deviceId)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.bundleName : ' + + JSON.stringify(element.bundleName)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.abilityName : ' + + JSON.stringify(element.abilityName)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.uri : ' + + JSON.stringify(element.uri)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.shortName : ' + + JSON.stringify(element.shortName)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect proxy : ' + + JSON.stringify(proxy)); + }, + onDisconnect: async function (element1: any) { + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.deviceId : ' + + JSON.stringify(element1.deviceId)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.bundleName : ' + + JSON.stringify(element1.bundleName)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.abilityName: ' + + JSON.stringify(element1.abilityName)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.uri : ' + + JSON.stringify(element1.uri)); + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.shortName : ' + + JSON.stringify(element1.shortName)); + }, + onFailed: async function (code: any) { + console.log('particleAbility_connectAbility_test_0100 ConnectAbility onFailed errCode : ' + code); + }, + } + + let connection_succeeded: any; + console.info('particleAbility_connectAbility_test_0100 start '); + var timeOldStamp = getNowTime(); + var connection = particleAbility.connectAbility(request, options); + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0100 connectability', timeOldStamp, timeNewStamp); + connection_succeeded = connection; + console.info('particleAbility_connectAbility_test_0100 service request is:' + JSON.stringify(request)); + console.info('particleAbility_connectAbility_test_0100 options is:' + JSON.stringify(options)); + console.info('particleAbility_connectAbility_test_0100 data is: ' + JSON.stringify(connection)); + console.info('particleAbility_connectAbility_test_0100 connection=: ' + connection); + sleep(5000); + console.info('particleAbility_connectAbility_test_0100 disconnectability start '); + var timeOldStamp = getNowTime(); + particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0100 disconnectability', timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0100 disconnectability succeeded: ' + + JSON.stringify(data)); + }).catch((error: any) => { + console.error('particleAbility_connectAbility_test_0100 disconnectability failed. Cause: ' + + JSON.stringify(error)); + }) + }, + onConnect(want) { + console.info('ServiceAbility2 onConnect'); + return new StubTest2("test"); + }, +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..72c61a28d0ce923795b0a7b8d5a0dfa2e598af64 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts @@ -0,0 +1,133 @@ +/** + * 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 particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc'; + +class StubTest3 extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility3 onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility3 op1:' + op1 + ' op2:' + op2); + } + return true; + } +} + +function getNowTime() { + return new Date().getTime(); +} + +function getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; +} + +async function sleep(time: any) { + var now = new Date(); + var exitTime = now.getTime() + time; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + break; + } + console.info(`sleep ${time} over...`); +} + +export default { + onStart() { + console.info('ServiceAbility3 onStart'); + }, + onStop() { + console.info('ServiceAbility3 onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility3 onCommand'); + let request = { + "bundleName": "com.ohos.acecollaboration", + "abilityName": "com.ohos.acecollaboration.ServiceAbility", + } + let options = { + onConnect: async function (element: any, proxy: any) { + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.deviceId : ' + + JSON.stringify(element.deviceId)) + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.bundleName : ' + + JSON.stringify(element.bundleName)) + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.abilityName : ' + + JSON.stringify(element.abilityName)) + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.uri : ' + + JSON.stringify(element.uri)) + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.shortName : ' + + JSON.stringify(element.shortName)) + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect proxy : ' + + JSON.stringify(proxy)); + }, + onDisconnect: async function (element1: any) { + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.deviceId :' + + JSON.stringify(element1.deviceId)); + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.bundleName :' + + JSON.stringify(element1.bundleName)); + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.abilityName :' + + JSON.stringify(element1.abilityName)); + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.uri : ' + + JSON.stringify(element1.uri)); + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.shortName : ' + + JSON.stringify(element1.shortName)); + }, + onFailed: function (code: any) { + console.log('particleAbility_connectAbility_test_0200 ConnectAbility onFailed errCode: ' + code) + }, + } + + let connection_succeeded: any; + console.info('particleAbility_connectAbility_test_0200 start '); + var timeOldStamp = getNowTime(); + var connection = particleAbility.connectAbility(request, options); + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0200 connectability', timeOldStamp, timeNewStamp); + connection_succeeded = connection; + console.info('particleAbility_connectAbility_test_0200 service request is:' + JSON.stringify(request)); + console.info('particleAbility_connectAbility_test_0200 options is:' + JSON.stringify(options)); + console.info('particleAbility_connectAbility_test_0200 connection=: ' + connection); + sleep(5000); + console.info('particleAbility_connectAbility_test_0200 disconnectability start '); + try { + var timeOldStamp = getNowTime(); + particleAbility.disconnectAbility(connection_succeeded, (error, data) => { + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0200 disconnectability', timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0200 disconnectability succeeded: ' + JSON.stringify(data)); + }) + } + catch(error: any){ + console.error('particleAbility_connectAbility_test_0200 disconnectability failed. Cause: ' + + JSON.stringify(error)); + } + }, + onConnect(want) { + console.info('ServiceAbility3 onConnect'); + return new StubTest3("test"); + }, +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..d35fb6c9b69ef69e536f5b53d8843a4e2fc39d00 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts @@ -0,0 +1,132 @@ +/** + * 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 particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc' + +class StubTest4 extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility4 onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility4 op1:' + op1 + ' op2:' + op2); + } + return true; + } +} + +function getNowTime() { + return new Date().getTime(); +} + +function getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; +} + +async function sleep(time: any) { + var now = new Date(); + var exitTime = now.getTime() + time; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + break; + } + console.info(`sleep ${time} over...`); +} + +export default { + onStart() { + console.info('ServiceAbility4 onStart'); + }, + onStop() { + console.info('ServiceAbility4 onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility4 onCommand'); + let request = { + "bundleName": "com.open.harmony.packagemag", + "abilityName": "com.open.harmony.packagemag.packServiceAbility", + } + let options = { + onConnect: async function (element: any, proxy: any) { + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.deviceId : ' + + JSON.stringify(element.deviceId)) + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.bundleName : ' + + JSON.stringify(element.bundleName)) + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.abilityName : ' + + JSON.stringify(element.abilityName)) + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.uri : ' + + JSON.stringify(element.uri)) + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.shortName : ' + + JSON.stringify(element.shortName)) + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect proxy : ' + + JSON.stringify(proxy)); + }, + onDisconnect: async function (element1: any) { + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.deviceId : ' + + JSON.stringify(element1.deviceId)); + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.bundleName: ' + + JSON.stringify(element1.bundleName)); + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.abilityName:' + + JSON.stringify(element1.abilityName)); + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.uri: ' + + JSON.stringify(element1.uri)); + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.shortName :' + + JSON.stringify(element1.shortName)); + }, + onFailed: function (code: any) { + console.log('particleAbility_connectAbility_test_0300 ConnectAbility onFailed errCode : '+ code); + }, + } + + let connection_succeeded: any; + console.info('particleAbility_connectAbility_test_0300 start '); + var timeOldStamp = getNowTime(); + var connection = particleAbility.connectAbility(request, options); + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0300 connectability', timeOldStamp, timeNewStamp); + connection_succeeded = connection; + console.info('particleAbility_connectAbility_test_0300 service request is:' + JSON.stringify(request)); + console.info('particleAbility_connectAbility_test_0300 options is:' + JSON.stringify(options)); + console.info('particleAbility_connectAbility_test_0300 data is: ' + JSON.stringify(connection)); + console.info('particleAbility_connectAbility_test_0300 connection=: ' + connection); + sleep(5000); + console.info('particleAbility_connectAbility_test_0300 disconnectability start '); + var timeOldStamp = getNowTime(); + particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0300 disconnectability', timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0300 disconnectability succeeded:' + + JSON.stringify(data)); + }).catch ((error: any) =>{ + console.error('particleAbility_connectAbility_test_0300 disconnectability failed. Cause: ' + + JSON.stringify(error)); + }) + }, + onConnect(want) { + console.info('ServiceAbility4 onConnect'); + return new StubTest4("test"); + }, +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..16a737c348c7c200b1ef49acc08c922c755f6e26 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts @@ -0,0 +1,147 @@ +/** + * 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 particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc' + +class StubTest5 extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility5 onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility5 op1:' + op1 + ' op2:' + op2); + } + return true; + } +} + +function getNowTime() { + return new Date().getTime(); +} + +function getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; +} + +async function sleep(time: any) { + var now = new Date(); + var exitTime = now.getTime() + time; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + break; + } + console.info(`sleep ${time} over...`); +} + +export default { + onStart() { + console.info('ServiceAbility5 onStart'); + }, + onStop() { + console.info('ServiceAbility5 onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility5 onCommand'); + let request = { + "bundleName": "", + "abilityName": "", + } + let options = { + onConnect: async function (element: any, proxy: any) { + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.deviceId : ' + + JSON.stringify(element.deviceId)) + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.bundleName : ' + + JSON.stringify(element.bundleName)) + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.abilityName : ' + + JSON.stringify(element.abilityName)) + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.uri : ' + + JSON.stringify(element.uri)) + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.shortName : ' + + JSON.stringify(element.shortName)) + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect proxy : ' + + JSON.stringify(proxy)); + }, + onDisconnect: function (element1: any) { + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.deviceId : ' + + JSON.stringify(element1.deviceId)); + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.bundleName: ' + + JSON.stringify(element1.bundleName)); + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.abilityName:' + + JSON.stringify(element1.abilityName)); + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.uri : ' + + JSON.stringify(element1.uri)); + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.shortName : ' + + JSON.stringify(element1.shortName)); + }, + onFailed: function (code: any) { + console.log('particleAbility_connectAbility_test_0400 ConnectAbility onFailed errCode:' + code); + }, + } + + let connection_succeeded: any; + console.info('particleAbility_connectAbility_test_0400 start '); + var timeOldStamp = getNowTime(); + var connection = particleAbility.connectAbility(request, options); + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0400 connectability', timeOldStamp, timeNewStamp); + connection_succeeded = connection; + console.info('particleAbility_connectAbility_test_0400 service request is:' + JSON.stringify(request)); + console.info('particleAbility_connectAbility_test_0400 options is:' + JSON.stringify(options)); + console.info('particleAbility_connectAbility_test_0400 connection=: ' + connection); + sleep(5000); + console.info('particleAbility_connectAbility_test_0400 disconnectability start '); + var timeOldStamp = getNowTime(); + particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0400 disconnectability', timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0400 disconnectability succeeded: ' + + JSON.stringify(data)); + }).catch((error: any) => { + console.error('particleAbility_connectAbility_test_0400 disconnectability failed. Cause: ' + + JSON.stringify(error)); + }); + sleep(5000); + console.info('particleAbility_connectAbility_test_0400 disconnectability_fail start '); + try { + var timeOldStamp = getNowTime(); + particleAbility.disconnectAbility(-1).then((data: any) => { + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0400 disconnectability_fail', + timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0400 disconnectability_fail succeeded: ' + + JSON.stringify(data)); + }) + } + catch (error: any) { + console.error('particleAbility_connectAbility_test_0400 disconnectability_fail failed. Cause: ' + + JSON.stringify(error)); + } + }, + onConnect(want) { + console.info('ServiceAbility5 onConnect'); + return new StubTest5("test"); + }, +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..b36d40babb5564311b59d2bb63837c2c6298a0a5 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts @@ -0,0 +1,108 @@ +/** + * 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 particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc' + +class StubTest6 extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility6 onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility6 op1:' + op1 + ' op2:' + op2); + } + return true; + } +} +function getNowTime() { + return new Date().getTime(); +} + +function getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; +} + +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + + let request = { + "bundleName":"com.ohos.acecollaboration", + "abilityName":"com.ohos.acecollaboration.xxx", + } + let options = { + onConnect:async function (element:any, proxy:any) { + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.deviceId : ' + + JSON.stringify(element.deviceId)) + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.bundleName : ' + + JSON.stringify(element.bundleName)) + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.abilityName : ' + + JSON.stringify(element.abilityName)) + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.uri : ' + + JSON.stringify(element.uri)) + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.shortName : ' + + JSON.stringify(element.shortName)) + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect proxy : ' + + JSON.stringify(proxy)); + }, + onDisconnect:function (element1:any) { + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.deviceId : ' + + JSON.stringify(element1.deviceId)); + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.bundleName: ' + + JSON.stringify(element1.bundleName)); + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.abilityName:' + + JSON.stringify(element1.abilityName)); + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.uri : ' + + JSON.stringify(element1.uri)); + console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.shortName : ' + + JSON.stringify(element1.shortName)); + }, + onFailed:function (code:any) { + console.log('particleAbility_connectAbility_test_0500 ConnectAbility service onFailed errCode:' + code) + }, + } + + console.info('particleAbility_connectAbility_test_0500 errorabilityName start'); + var timeOldStamp = getNowTime(); + var connection = particleAbility.connectAbility(request, options); + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0500 connectability', timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0500 errorabilityName request is:' + + JSON.stringify(request)); + console.info('particleAbility_connectAbility_test_0500 errorabilityName options is:' + + JSON.stringify(options)); + console.info('particleAbility_connectAbility_test_0500 errorabilityName connection=: ' + connection); + }, + onConnect(want) { + console.info('ServiceAbility6 onConnect'); + return new StubTest6("test"); + }, +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..32fe65dec8ea4d8e89197d561f6cecc2785db423 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts @@ -0,0 +1,135 @@ +/** + * 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 particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc' + +class StubTest7 extends rpc.RemoteObject { + constructor(des) { + super(des) + } + + onRemoteRequest(code, data, reply, option) { + console.info('ServiceAbility7 onRemoteRequest'); + if (code === 1) { + let op1 = data.readInt(); + let op2 = data.readInt(); + reply.writeInt(op1 + op2); + console.info('ServiceAbility7 op1:' + op1 + ' op2:' + op2); + } + return true; + } +} + +function getNowTime() { + return new Date().getTime(); +} + +function getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; +} + +async function sleep(time: any) { + var now = new Date(); + var exitTime = now.getTime() + time; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + break; + } + console.info(`sleep ${time} over...`); +} +export default { + onStart() { + console.info('ServiceAbility7 onStart'); + }, + onStop() { + console.info('ServiceAbility7 onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility7 onCommand'); + + let request = { + "bundleName":"com.example.myapplication", + "abilityName":"com.example.myapplication.ServiceAbility_API8", + } + let options = { + onConnect:async function (element:any, proxy:any) { + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.deviceId : ' + + JSON.stringify(element.deviceId)) + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.bundleName : ' + + JSON.stringify(element.bundleName)) + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.abilityName : ' + + JSON.stringify(element.abilityName)) + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.uri : ' + + JSON.stringify(element.uri)) + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.shortName : ' + + JSON.stringify(element.shortName)) + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect proxy : ' + + JSON.stringify(proxy)); + }, + onDisconnect:async function (element1:any) { + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.deviceId : ' + + JSON.stringify(element1.deviceId)); + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.bundleName: ' + + JSON.stringify(element1.bundleName)); + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.abilityName:' + + JSON.stringify(element1.abilityName)); + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.uri : ' + + JSON.stringify(element1.uri)); + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.shortName : ' + + JSON.stringify(element1.shortName)); + }, + onFailed:function (code:any) { + console.log('particleAbility_connectAbility_test_0600 ConnectAbility onFailed errCode:' + code); + }, + } + + let connection_succeeded:any; + console.info('particleAbility_connectAbility_test_0600 start '); + var timeOldStamp = getNowTime(); + var connection = particleAbility.connectAbility(request, options); + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0600 connectability', timeOldStamp, timeNewStamp); + connection_succeeded = connection; + console.info('particleAbility_connectAbility_test_0600 service request is:' + JSON.stringify(request)); + console.info('particleAbility_connectAbility_test_0600 options is:' + JSON.stringify(options)); + console.info('particleAbility_connectAbility_test_0600 data is: ' + JSON.stringify(connection)); + console.info('particleAbility_connectAbility_test_0600 connection=: ' + connection); + sleep(5000); + console.info('particleAbility_connectAbility_test_0600 disconnectability start '); + var timeOldStamp = getNowTime(); + particleAbility.disconnectAbility(connection_succeeded).then((data: any) => { + var timeNewStamp = getNowTime(); + getDurationTime('particleAbility_connectAbility_test_0600 disconnectability', timeOldStamp, timeNewStamp); + console.info('particleAbility_connectAbility_test_0600 disconnectability succeeded: ' + + JSON.stringify(data)); + }).catch((error: any) =>{ + console.error('particleAbility_connectAbility_test_0600 disconnectability failed. Cause: ' + + JSON.stringify(error)); + }); + }, + onConnect(want) { + console.info('ServiceAbility7 onConnect'); + return new StubTest7("test"); + }, + onDisConnect(want) { + console.info('ServiceAbility7 onDisConnect'); + }, +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/app.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..1405dd359f629939894b86e2b285cb2cc1b37aa6 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,32 @@ +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..52663437cb619d4598126cf403d3689cb31ba131 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* + * 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 Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..14e78a653e030645860bcc3e7eb6c600b098127b --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,77 @@ +/* + * 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 itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + 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') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -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 call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c442900cc5e9e0fc62dff853788c7f3826655213 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets @@ -0,0 +1,249 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeEach, afterEach, it, expect} from 'hypium/index'; +import Utils from './Utils'; + +export default function ContextJsunit() { + describe('appInfoTest_ability_2', function () { + beforeEach(async function (done) { + console.info("context before each called"); + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("context after each called"); + }); + + /* + * @tc.number: context_getCacheDir_test_0100 + * @tc.name: getCacheDir : Obtains the Cache directory on internal storage. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it("context_getCacheDir_test_0100", 0, async function (done) { + console.log("------------------start context_getCacheDir_test_0100-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getCacheDir().then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getCacheDir_test_0100', timeOldStamp, timeNewStamp) + console.log("context_getCacheDir_test_0100: CacheDir is " + data); + }) + } catch (error) { + console.log("logMessage context_getCacheDir_test_0100: error = " + error); + expect(error).assertEqual("/data/storage/el2/base/haps/entry/cache"); + } + var data1 = await context.getCacheDir(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("/data/storage/el2/base/haps/entry/cache"); + done(); + console.log("------------------end context_getCacheDir_test_0100-------------------"); + }); + + /* + * @tc.number: context_getCacheDir_test_0200 + * @tc.name: getCacheDir : Obtains the Cache directory on internal storage. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it("context_getCacheDir_test_0200", 0, async function (done) { + console.log("------------------start context_getCacheDir_test_0200-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getCacheDir((err, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getCacheDir_test_0200', timeOldStamp, timeNewStamp) + console.log("context_getCacheDir_test_0200: getCacheDir successful, result = " + data); + }); + } catch (error) { + console.log("logMessage context_getCacheDir_test_0200: error = " + error); + expect(error).assertEqual("/data/storage/el2/base/haps/entry/cache"); + } + var data1 = await context.getCacheDir(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("/data/storage/el2/base/haps/entry/cache"); + done(); + console.log("------------------end context_getCacheDir_test_0200-------------------"); + }); + + /* + * @tc.number: context_getFilesDir_test_0100 + * @tc.name: getFilesDir : Obtains the files directory on internal storage. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it("context_getFilesDir_test_0100", 0, async function (done) { + console.log("------------------start context_getFilesDir_test_0100-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getFilesDir().then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getFilesDir_test_0100', timeOldStamp, timeNewStamp) + console.log("context_getFilesDir_test_0100:FilesDir is " + data); + }) + } catch (error) { + console.log("logMessage context_getFilesDir_test_0100: error = " + error); + expect(error).assertEqual("/data/storage/el2/base/haps/entry/files"); + } + var data1 = await context.getFilesDir(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("/data/storage/el2/base/haps/entry/files"); + done(); + console.log("------------------end context_getFilesDir_test_0100-------------------"); + }); + + /* + * @tc.number: context_getFilesDir_test_0200 + * @tc.name: getFilesDir : Obtains the files directory on internal storage. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it("context_getFilesDir_test_0200", 0, async function (done) { + console.log("------------------start context_getFilesDir_test_0200-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getFilesDir((err, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getFilesDir_test_0200', timeOldStamp, timeNewStamp) + console.log("context_getFilesDir_test_0200: getFilesDir successful, result = " + data); + }); + } catch (error) { + console.log("logMessage context_getFilesDir_test_0200: error = " + error); + expect(error).assertEqual("/data/storage/el2/base/haps/entry/files"); + } + var data1 = await context.getFilesDir(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("/data/storage/el2/base/haps/entry/files"); + done(); + console.log("------------------end context_getFilesDir_test_0200-------------------"); + }); + + + /* + * @tc.number: context_getOrCreateDistributedDir_test_0100 + * @tc.name: getOrCreateDistributedDir : Obtains the directory of Distributed files. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it("context_getOrCreateDistributedDir_0100", 0, async function (done) { + console.log("------------------start context_getOrCreateDistributedDir_0100-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getOrCreateDistributedDir().then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getOrCreateDistributedDir_0100', timeOldStamp, timeNewStamp); + console.log("context_getOrCreateDistributedDir_0100: DistributedDir is " + data); + }) + } catch (error) { + console.log("logMessage context_getOrCreateDistributedDir_0100: error = " + error); + expect(error).assertEqual("/data/storage/el2/distributedfiles/entry"); + } + var data1 = await context.getOrCreateDistributedDir(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("/data/storage/el2/distributedfiles"); + done(); + console.log("------------------end context_getOrCreateDistributedDir_0100-------------------"); + }); + + /* + * @tc.number: context_getOrCreateDistributedDir_0200 + * @tc.name: getOrCreateDistributedDir : Obtains the directory of Distributed files. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it("context_getOrCreateDistributedDir_0200", 0, async function (done) { + console.log("------------------start context_getOrCreateDistributedDir_0200-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getOrCreateDistributedDir((err, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getOrCreateDistributedDir_0200', timeOldStamp, timeNewStamp); + console.log("context_getOrCreateDistributedDir_0200: getOrCreateDistributedDir successful, result = " + data); + }); + } catch (error) { + console.log("logMessage context_getOrCreateDistributedDir_0200: error = " + error); + expect(error).assertEqual("/data/storage/el2/distributedfiles/entry"); + } + var data1 = await context.getOrCreateDistributedDir(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("/data/storage/el2/distributedfiles"); + done(); + console.log("------------------end context_getOrCreateDistributedDir_0200-------------------"); + }); + + /* + * @tc.number: context_getAppType_0100 + * @tc.name: getAppType : Obtains the type of current application. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it("context_getAppType_0100", 0, async function (done) { + console.log("------------------start context_getAppType_0100-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getAppType().then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAppType_0100_0100', timeOldStamp, timeNewStamp); + console.log("context_getAppType_0100: AppType is " + data); + }) + } catch (error) { + console.log("logMessage context_getAppType_0100: error = " + error); + expect(error).assertEqual("system"); + } + var data1 = await context.getAppType(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("system"); + done(); + console.log("------------------end context_getAppType_0100-------------------"); + }); + + /* + * @tc.number: context_getAppType_0200 + * @tc.name: getAppType : Obtains the type of current application. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it("context_getAppType_0200", 0, async function (done) { + console.log("------------------start context_getAppType_0200-------------------"); + try { + var timeOldStamp = await Utils.getNowTime(); + var context = await featureAbility.getContext(); + context.getAppType((err, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAppType_0200_0100', timeOldStamp, timeNewStamp); + console.log("context_getAppType_0200: getAppType successful, result = " + data); + }); + } catch (error) { + console.log("logMessage context_getAppType_0200: error = " + error); + expect(error).assertEqual("system"); + } + var data1 = await context.getAppType(); + expect(typeof (data1)).assertEqual("string"); + expect(data1).assertEqual("system"); + done(); + console.log("------------------end context_getAppType_0200-------------------"); + }); + }) +} diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe2b0eecc21e0fdcf3b561272581b4eedd6d7b9a --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,30 @@ +/** + * 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 addContextAndAbilityJsunit from './addContextAndAbilityJsunit.test.ets'; +import getHapModuleInfoJsunit from './getHapModuleInfoJsunit.test.ets'; +import getAbilityInfoJsunit from './getAbilityInfoJsunit.test.ets'; +import getApplicationContext from './getApplicationContextJsunit.test.ets'; +import getAppVersionInfoJsunit from './getAppVersionInfoJsunit.test.ets'; +import ContextJsunit from './ContextJsunit.test.ets'; + +export default function testsuite() { + ContextJsunit(); + addContextAndAbilityJsunit(); + getHapModuleInfoJsunit(); + getAbilityInfoJsunit(); + getApplicationContext(); + getAppVersionInfoJsunit(); +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/Utils.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d2d038c5d93dd0edbe4aff416e29880e41a454c --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/Utils.ets @@ -0,0 +1,47 @@ +/** + * 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 class Utils { + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(reject) + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getNowTime() { + return new Date().getTime(); + } + + /** + * 接口调用时间 + * @param startTime 接口调用开始时间 + * @param endTime 接口调用结束时间 + */ + static getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; + } +} + + + + diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfef54ca08517e7f3b1fa648c39aa418e92aa004 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets @@ -0,0 +1,301 @@ +/** + * 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 {describe, it, expect} from 'hypium/index'; +import Utils from './Utils'; +import ability_featureAbility from '@ohos.ability.featureAbility'; +import ability_particleAbility from '@ohos.ability.particleAbility'; +import abilityManager from "@ohos.application.appManager" + +const TAG_TEST_0100 = ' context_isUpdatingConfigurations_test_0100 '; +const TAG_TEST_0200 = ' context_isUpdatingConfigurations_test_0200 '; +const TAG_TEST_0300 = ' context_printDrawnCompleted_test_0100 '; +const TAG_TEST_0400 = ' context_printDrawnCompleted_test_0200 '; +const TAG_TEST_0500 = ' context_getAppMemorySize_test_0100 '; +const TAG_TEST_0600 = ' context_getAppMemorySize_test_0200 '; +const TAG_TEST_0700 = ' context_isRamConstrainedDevice_test_0100 '; +const TAG_TEST_0800 = ' context_isRamConstrainedDevice_test_0200 '; +const TAG_TEST_0900 = ' context_featureAbility_test_0100 '; +const TAG_TEST_0010 = ' context_featureAbility_test_0200 '; +const TAG_TEST_0011 = ' context_featureAbility_test_0300 '; +const TAG_TEST_0012 = ' context_featureAbility_test_0400 '; + +export default function addContextAndAbilityJsunit() { + describe('appInfoTest_ability_1', function () { + /* + * @tc.number: context_isUpdatingConfigurations_test_0100 + * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it(TAG_TEST_0100, 0, async function (done) { + console.info(TAG_TEST_0100 + 'promise START'); + let detailed; + var startTime = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + await context.isUpdatingConfigurations().then((data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0100, startTime, endTime) + console.info(TAG_TEST_0100 + ' promise data is:' + JSON.stringify(data)); + detailed = data; + }).catch((error) => { + console.error(TAG_TEST_0100 + 'promise errors is: ' + JSON.stringify(error)); + }) + expect(typeof (detailed)).assertEqual("boolean"); + expect(detailed).assertEqual(false); + done(); + console.log('------------------ ' + TAG_TEST_0100 + ' end -------------------'); + }); + + /* + * @tc.number: context_isUpdatingConfigurations_test_0200 + * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it(TAG_TEST_0200, 0, async function (done) { + let detailed; + console.info(TAG_TEST_0200 + 'callBack START'); + try { + var startTime = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.isUpdatingConfigurations((error, data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0200, startTime, endTime) + detailed = data; + console.info(TAG_TEST_0200 + ' callBack succeeded. data is:' + JSON.stringify(data)); + }); + } catch (error) { + console.error(TAG_TEST_0200 + 'Operation failed. Cause: ' + JSON.stringify(error)); + } + await Utils.sleep(2000) + expect(typeof (detailed)).assertEqual("boolean"); + expect(detailed).assertEqual(false); + done(); + console.log('------------------ ' + TAG_TEST_0200 + ' end -------------------'); + }); + + /* + * @tc.number: context_printDrawnCompleted_test_0100 + * @tc.name: printDrawnCompleted : Inform the system of the time required to complete the drawing of the page + capability. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it(TAG_TEST_0300, 0, async function (done) { + let detailed; + console.info(TAG_TEST_0300 + 'callBack START'); + var startTime = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + await context.printDrawnCompleted().then((data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0300, startTime, endTime) + console.info(TAG_TEST_0300 + ' promise data is:' + JSON.stringify(data)); + detailed = data; + }).catch((error) => { + console.error(TAG_TEST_0300 + 'promise error is: ' + JSON.stringify(error)); + }); + await Utils.sleep(2000) + expect(detailed).assertEqual(null); + done(); + console.log('------------------ ' + TAG_TEST_0300 + ' end -------------------'); + }) + + + /* + * @tc.number: context_printDrawnCompleted_test_0200 + * @tc.name: printDrawnCompleted : Inform the system of the time required to complete the drawing of the page + capability. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it(TAG_TEST_0400, 0, async function (done) { + let detailed; + console.info(TAG_TEST_0400 + 'callBack START'); + try { + var startTime = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.printDrawnCompleted((error, data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0300, startTime, endTime) + detailed = data; + console.info(TAG_TEST_0400 + ' callBack succeeded. data is:' + JSON.stringify(data)); + }); + } catch (error) { + console.error(TAG_TEST_0400 + 'Operation failed. Cause: ' + JSON.stringify(error)); + } + await Utils.sleep(2000) + expect(detailed).assertEqual(null); + done(); + console.log('------------------ ' + TAG_TEST_0400 + ' end -------------------'); + }) + + + /* + * @tc.number: context_getAppMemorySize_test_0100 + * @tc.name: getAppMemorySize : Obtains the memory size of the application. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it(TAG_TEST_0500, 0, async function (done) { + console.info(TAG_TEST_0500 + 'promise START'); + let detailed; + var startTime = await Utils.getNowTime(); + await abilityManager.getAppMemorySize() + .then((data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) + console.info(TAG_TEST_0500 + ' promise data is:' + JSON.stringify(data)); + detailed = data; + }).catch((error) => { + console.error(TAG_TEST_0500 + 'promise errors is: ' + JSON.stringify(error)); + }) + await Utils.sleep(2000) + expect(typeof (detailed)).assertEqual("number"); + expect(detailed).assertEqual(512); + done(); + console.log('------------------ ' + TAG_TEST_0500 + ' end -------------------'); + }); + + /* + * @tc.number: context_getAppMemorySize_test_0200 + * @tc.name: getAppMemorySize : Obtains the memory size of the application. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it(TAG_TEST_0600, 0, async function (done) { + console.info(TAG_TEST_0600 + 'callBack START'); + var startTime = await Utils.getNowTime(); + abilityManager.getAppMemorySize((error, data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) + console.info(TAG_TEST_0600 + ' callBack error is: ' + JSON.stringify(error)); + console.info(TAG_TEST_0600 + ' callBack data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("number"); + expect(data).assertEqual(512); + console.log('------------------ ' + TAG_TEST_0600 + ' end -------------------'); + done(); + }) + }); + + /* + * @tc.number: context_isRamConstrainedDevice_test_0100 + * @tc.name: isRamConstrainedDevice : Obtains whether the current device has low ram. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it(TAG_TEST_0700, 0, async function (done) { + let detailed; + console.info(TAG_TEST_0700 + 'promise START'); + var startTime = await Utils.getNowTime(); + await abilityManager.isRamConstrainedDevice().then((data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) + console.info(TAG_TEST_0700 + ' promise data is:' + JSON.stringify(data)); + detailed = data; + }).catch((error) => { + console.error(TAG_TEST_0700 + 'promise errors is: ' + JSON.stringify(error)); + }) + await Utils.sleep(1000) + expect(typeof (detailed)).assertEqual("boolean"); + expect(detailed).assertEqual(false) + done(); + console.log('------------------ ' + TAG_TEST_0700 + ' end -------------------'); + }); + + /* + * @tc.number: context_isRamConstrainedDevice_test_0200 + * @tc.name: isRamConstrainedDevice : Obtains whether the current device has low ram. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it(TAG_TEST_0800, 0, async function (done) { + console.info(TAG_TEST_0800 + 'callBack START'); + var startTime = await Utils.getNowTime(); + abilityManager.isRamConstrainedDevice((error, data) => { + var endTime = Utils.getNowTime(); + Utils.getDurationTime(TAG_TEST_0500, startTime, endTime) + console.info(TAG_TEST_0800 + ' callBack error is:' + error); + console.info(TAG_TEST_0800 + ' callBack data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("boolean"); + expect(data).assertEqual(false); + done(); + }) + console.log('------------------ ' + TAG_TEST_0800 + ' end -------------------'); + }); + /* + * @tc.number: context_featureAbility_test_0100 + * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode + * @tc.desc: Check the featureAbility.ErrorCode.NO_ERROR + * @tc.level 0 + */ + it(TAG_TEST_0900, 0, async function (done) { + console.info(TAG_TEST_0900 + ' NO_ERROR START'); + var no_error = ability_featureAbility.ErrorCode.NO_ERROR + console.info(TAG_TEST_0900 + ' featureAbility no_error is: ' + no_error); + expect(typeof (no_error)).assertEqual("number"); + expect(no_error).assertEqual(0); + done(); + console.log('------------------ ' + TAG_TEST_0900 + ' end -------------------'); + }); + + /* + * @tc.number: context_featureAbility_test_0200 + * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode + * @tc.desc: Check the featureAbility.ErrorCode.INVALID_PARAMETER + * @tc.level 0 + */ + it(TAG_TEST_0010, 0, async function (done) { + console.info(TAG_TEST_0010 + ' INVALID_PARAMETER START'); + var invalid_parameter = ability_featureAbility.ErrorCode.INVALID_PARAMETER + console.info(TAG_TEST_0010 + ' featureAbility invalid_parameter is: ' + invalid_parameter); + expect(typeof (invalid_parameter)).assertEqual("number"); + expect(invalid_parameter).assertEqual(-1); + done(); + console.log('------------------ ' + TAG_TEST_0010 + ' end -------------------'); + }); + + /* + * @tc.number: context_featureAbility_test_0300 + * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode + * @tc.desc: Check the featureAbility.ErrorCode.ABILITY_NOT_FOUND + * @tc.level 0 + */ + it(TAG_TEST_0011, 0, async function (done) { + console.info(TAG_TEST_0011 + ' ABILITY_NOT_FOUND START'); + var ability_not_found = ability_featureAbility.ErrorCode.ABILITY_NOT_FOUND + console.info(TAG_TEST_0011 + ' featureAbility ability_not_found is: ' + ability_not_found); + expect(typeof (ability_not_found)).assertEqual("number"); + expect(ability_not_found).assertEqual(-2); + done(); + console.log('------------------ ' + TAG_TEST_0011 + ' end -------------------'); + }); + + /* + * @tc.number: context_featureAbility_test_0400 + * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode + * @tc.desc: Check the featureAbility.ErrorCode.PERMISSION_DENY + * @tc.level 0 + */ + it(TAG_TEST_0012, 0, async function (done) { + console.info(TAG_TEST_0012 + ' PERMISSION_DENY START'); + var permission_deny = ability_featureAbility.ErrorCode.PERMISSION_DENY + console.info(TAG_TEST_0012 + ' featureAbility permission_deny is: ' + permission_deny); + expect(typeof (permission_deny)).assertEqual("number"); + expect(permission_deny).assertEqual(-3); + done(); + console.log('------------------ ' + TAG_TEST_0012 + ' end -------------------'); + }); + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..82186bfa45f16fd639b278bd70d6fe7542b965a0 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets @@ -0,0 +1,333 @@ +/** + * 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 {describe, it, expect} from 'hypium/index'; +import Utils from './Utils'; +import ability_featureAbility from '@ohos.ability.featureAbility'; + +export default function getHapModuleInfoJsunit() { + describe('appInfoTest_ability_3', function () { + + /** + * @tc.number: context_getAbilityInfo_test_0100 + * @tc.name: getAbilityInfo:Query the current attributionability details. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it('context_getAbilityInfo_test_0100', 0, async function (done) { + console.info('[context_getAbilityInfo_test_0100] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + await context.getAbilityInfo() + .then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAbilityInfo_test_0100', timeOldStamp, timeNewStamp); + console.info('[context_getAbilityInfo_test_0100] data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("object"); + }).catch((error) => { + console.error('[context_getAbilityInfo_test_0100] failed:' + JSON.stringify(error)); + }) + var promise = await context.getAbilityInfo(); + console.info('--[context_getAbilityInfo_test_0100] check---'); + checkAbilityInfo('context_getAbilityInfo_test_0100', promise); + console.info('[context_getAbilityInfo_test_0100] FINISH'); + done(); + }); + + async function startAbility2() { + var str = { + "want": { + "bundleName": "com.ohos.acecollaboration", + "abilityName": "com.ohos.acecollaboration.MainAbility2", + }, + }; + ability_featureAbility.startAbility(str).then((data) => { + console.info('context_getAbilityInfo_test_0300 startMainAbility2 succeeded: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('context_getAbilityInfo_test_0300 startMainAbility2 failed. Cause: ' + JSON.stringify(error)); + }); + } + + /** + * @tc.number: context_getAbilityInfo_test_0200 + * @tc.name: getAbilityInfo:Query the current attributionability details. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + * @tc.level 0 + */ + it('context_getAbilityInfo_test_0200', 0, async function (done) { + try { + console.info('[context_getAbilityInfo_test_0200] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.getAbilityInfo((error, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAbilityInfo_test_0200', timeOldStamp, timeNewStamp); + console.info('[context_getAbilityInfo_test_0200] data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("object"); + }); + } catch (error) { + console.error('[context_getAbilityInfo_test_0200] failed: ' + JSON.stringify(error)); + } + var callback = await context.getAbilityInfo(); + console.info('---[context_getAbilityInfo_test_0200] check---'); + checkAbilityInfo('context_getAbilityInfo_test_0200', callback); + console.info('[context_getAbilityInfo_test_0200] FINISH'); + done(); + }) + + + /** + * @tc.number: context_getAbilityInfo_test_0300_1 + * @tc.name: getAbilityInfo:Query the current attributionability details. + * @tc.desc: Check the return value of the interface + * @tc.level 0 + */ + it('context_getAbilityInfo_test_0300_1', 0, async function (done) { + console.info('[context_getAbilityInfo_test_0300] STARTability'); + startAbility2(); + done(); + }); + + /** + * @tc.number: context_getAbilityInfo_test_0400 + * @tc.name: getAbilityInfo:Query the current attributionability details. + * @tc.desc: Check the return value of the interface (by promise) + * @tc.level 0 + */ + it('context_getAbilityInfo_test_0400', 0, async function (done) { + console.info('[context_getAbilityInfo_test_0400] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + await context.getAbilityInfo() + .then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAbilityInfo_test_0400', timeOldStamp, timeNewStamp); + console.info('[context_getAbilityInfo_test_0400] data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("object"); + }).catch((error) => { + console.error('[context_getAbilityInfo_test_0400] failed:' + JSON.stringify(error)); + }) + var promise = await context.getAbilityInfo(); + console.info('--[context_getAbilityInfo_test_0400] check---'); + checkAbilityInfo('context_getAbilityInfo_test_0400', promise); + console.info('[context_getAbilityInfo_test_0400] FINISH'); + done(); + }); + + function checkAbilityInfo(msg, data) { + console.log(msg + "checkAbilityInfo start " + JSON.stringify(data)); + console.log(msg + "checkAbilityInfo bundleName : " + data.bundleName); + console.log(msg + "checkAbilityInfo name : " + data.name); + console.log(msg + "checkAbilityInfo label : " + data.label); + console.log(msg + "checkAbilityInfo description : " + data.description); + console.log(msg + "checkAbilityInfo icon : " + data.icon); + console.log(msg + "checkAbilityInfo descriptionId : " + data.descriptionId); + console.log(msg + "checkAbilityInfo iconId : " + data.iconId); + console.log(msg + "checkAbilityInfo moduleName : " + data.moduleName); + console.log(msg + "checkAbilityInfo process : " + data.process); + console.log(msg + "checkAbilityInfo targetAbility : " + data.targetAbility); + console.log(msg + "checkAbilityInfo backgroundModes : " + data.backgroundModes); + console.log(msg + "checkAbilityInfo isVisible : " + data.isVisible); + console.log(msg + "checkAbilityInfo formEnabled : " + data.formEnabled); + console.log(msg + "checkAbilityInfo type : " + data.type) + console.log(msg + "checkAbilityInfo orientation : " + data.orientation); + console.log(msg + "checkAbilityInfo launchMode : " + data.launchMode); + console.log(msg + "checkAbilityInfo permissions length : " + data.permissions.length); + for (var j = 0; j < data.permissions.length; j++) { + console.log(msg + "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); + } + console.log(msg + "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); + for (var k = 0; k < data.deviceTypes.length; k++) { + console.log(msg + "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); + } + console.log(msg + "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); + for (var i = 0; i < data.deviceCapabilities.length; i++) { + console.log(msg + "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]); + } + console.log(msg + "checkAbilityInfo readPermission : " + data.readPermission); + console.log(msg + "checkAbilityInfo writePermission : " + data.writePermission); + console.log(msg + "checkAbilityInfo formEntity : " + data.formEntity); + console.log(msg + "checkAbilityInfo minFormHeight : " + data.minFormHeight); + console.log(msg + "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); + console.log(msg + "checkAbilityInfo minFormWidth : " + data.minFormWidth); + console.log(msg + "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); + console.log(msg + "checkAbilityInfo uri : " + data.uri); + console.log(msg + "checkAbilityInfo customizeData : " + data.customizeData); + console.log(msg + "checkAbilityInfo labelId : " + data.labelId); + console.log(msg + "checkAbilityInfo subType : " + data.subType); + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.bundleName)).assertEqual("string"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("number"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.iconId)).assertEqual("number"); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.process)).assertEqual("string"); + expect(typeof (data.targetAbility)).assertEqual("string"); + expect(typeof (data.backgroundModes)).assertEqual("number"); + expect(typeof (data.isVisible)).assertEqual("boolean"); + expect(typeof (data.formEnabled)).assertEqual("boolean"); + expect(typeof (data.type)).assertEqual("number"); + expect(typeof (data.subType)).assertEqual("number"); + expect(typeof (data.orientation)).assertEqual("number"); + expect(typeof (data.launchMode)).assertEqual("number"); + expect(Array.isArray(data.permissions)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); + expect(typeof (data.readPermission)).assertEqual("string"); + expect(typeof (data.writePermission)).assertEqual("string"); + expect(typeof (data.applicationInfo)).assertEqual("object"); + expect(typeof (data.formEntity)).assertEqual("number"); + expect(typeof (data.minFormHeight)).assertEqual("number"); + expect(typeof (data.defaultFormHeight)).assertEqual("number"); + expect(typeof (data.minFormWidth)).assertEqual("number"); + expect(typeof (data.defaultFormWidth)).assertEqual("number"); + expect(typeof (data.uri)).assertEqual("string"); + + expect(data.bundleName).assertEqual("com.ohos.acecollaboration"); + expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility"); + expect(data.label).assertEqual("$string:entry_MainAbility"); + expect(data.description).assertEqual("$string:mainability_description"); + expect(data.icon).assertEqual("$media:icon"); + expect(data.descriptionId > 0).assertTrue(); + expect(data.iconId > 0).assertTrue(); + expect(data.moduleName).assertEqual("entry"); + expect(data.process).assertEqual(""); + expect(data.targetAbility).assertEqual(""); + expect(data.backgroundModes).assertEqual(0); + expect(data.isVisible).assertEqual(true); + expect(data.formEnabled).assertEqual(false); + expect(data.type).assertEqual(1); + expect(data.orientation).assertEqual(0); + expect(data.launchMode).assertEqual(1); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.readPermission).assertEqual(""); + expect(data.writePermission).assertEqual(""); + checkApplicationInfo(msg, data.applicationInfo); + expect(data.formEntity).assertEqual(0); + expect(data.minFormHeight).assertEqual(0); + expect(data.defaultFormHeight).assertEqual(0); + expect(data.minFormWidth).assertEqual(0); + expect(data.defaultFormWidth).assertEqual(0); + expect(data.uri).assertEqual(""); + expect(data.labelId > 0).assertTrue(); + expect(data.subType).assertEqual(0); + + console.log(msg + "---checkAbilityInfo End--- "); + } + + function checkApplicationInfo(msg, info) { + console.log(msg + "checkApplicationInfo start : " + JSON.stringify(info)); + console.log(msg + "checkApplicationInfo name : " + info.name); + console.log(msg + "checkApplicationInfo description : " + info.description); + console.log(msg + "checkApplicationInfo descriptionId : " + info.descriptionId); + console.log(msg + "checkApplicationInfo systemApp : " + info.systemApp); + console.log(msg + "checkApplicationInfo enabled : " + info.enabled); + console.log(msg + "checkApplicationInfo label : " + info.label); + console.log(msg + "checkApplicationInfo labelId : " + info.labelId); + console.log(msg + "checkApplicationInfo icon : " + info.icon); + console.log(msg + "checkApplicationInfo iconId : " + info.iconId); + console.log(msg + "checkApplicationInfo process : " + info.process); + console.log(msg + "checkApplicationInfo supportedModes : " + info.supportedModes); + + console.log(msg + "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length); + for (var j = 0; j < info.moduleSourceDirs.length; j++) { + console.log(msg + "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]); + } + console.log(msg + "checkApplicationInfo permissions length : " + info.permissions.length); + for (var k = 0; k < info.permissions.length; k++) { + console.log(msg + "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]); + } + console.log(msg + "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length); + for (var i = 0; i < info.moduleInfos.length; i++) { + console.log(msg + "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " + + info.moduleInfos[i].moduleName); + console.log(msg + "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " + + info.moduleInfos[i].moduleSourceDir); + } + console.log(msg + "checkApplicationInfo entryDir : " + info.entryDir); + + expect(typeof (info)).assertEqual("object"); + expect(typeof (info.name)).assertEqual("string"); + expect(typeof (info.description)).assertEqual("string"); + expect(typeof (info.descriptionId)).assertEqual("number"); + expect(typeof (info.systemApp)).assertEqual("boolean"); + expect(typeof (info.enabled)).assertEqual("boolean"); + expect(typeof (info.label)).assertEqual("string"); + expect(typeof (info.labelId)).assertEqual("string"); + expect(typeof (info.icon)).assertEqual("string"); + expect(typeof (info.iconId)).assertEqual("string"); + expect(typeof (info.process)).assertEqual("string"); + expect(typeof (info.supportedModes)).assertEqual("number"); + expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); + expect(Array.isArray(info.permissions)).assertEqual(true); + expect(Array.isArray(info.moduleInfos)).assertEqual(true); + expect(typeof (info.entryDir)).assertEqual("string"); + + expect(info.name).assertEqual("com.ohos.acecollaboration"); + expect(info.description).assertEqual("$string:mainability_description"); + expect(info.descriptionId > 0).assertTrue(); + expect(info.systemApp).assertEqual(true); + expect(info.enabled).assertEqual(true); + expect(info.label).assertEqual("$string:entry_MainAbility"); + expect(info.icon).assertEqual("$media:icon"); + expect(info.process).assertEqual(""); + expect(info.supportedModes).assertEqual(0); + expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + if (info.moduleSourceDirs.length == 1){ + expect(info.moduleInfos[0].moduleName).assertEqual("entry"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + }else if(info.moduleSourceDirs.length == 2) { + if (info.moduleInfos[0].moduleName == "myapplication1") { + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication1"); + expect(info.moduleInfos[1].moduleName).assertEqual("entry"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + }else{ + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication2"); + expect(info.moduleInfos[1].moduleName).assertEqual("entry"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + } + }else { + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication1"); + expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication2"); + expect(info.moduleInfos[2].moduleName).assertEqual("entry"); + expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + } + + console.log(msg + "---checkApplicationInfo End--- "); + + } + + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..df44372bd1631dacf8effb3541fa8be9ab7bff7b --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets @@ -0,0 +1,92 @@ +/** + * 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 {describe, it, expect} from 'hypium/index'; +import Utils from './Utils'; +import ability_featureAbility from '@ohos.ability.featureAbility'; + +export default function getHapModuleInfoJsunit() { + describe('appInfoTest_ability_5', function () { + /** + * @tc.number: context_getAppVersionInfo_test_0100 + * @tc.name: getAppVersionInfo:Gets the version information for the application. + * @tc.desc: Check the return type of the interface (by Promise) + * @tc.level 0 + */ + it('context_getAppVersionInfo_test_0100', 0, async function (done) { + console.info('[context_getAppVersionInfo_test_0100] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.getAppVersionInfo() + .then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAppVersionInfo_test_0100', timeOldStamp, timeNewStamp); + console.info('[context_getAppVersionInfo_test_0100] data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("object"); + }).catch((error) => { + console.error('[context_getAppVersionInfo_test_0100] failed:' + JSON.stringify(error)); + }) + var promise = await context.getAppVersionInfo(); + console.info('---[context_getAppVersionInfo_test_0100] check---'); + checkAppVersionInfo('context_getAppVersionInfo_test_0100', promise); + console.info('[context_getAppVersionInfo_test_0100] FINISH'); + done(); + }); + + /** + * @tc.number: context_getAppVersionInfo_test_0200 + * @tc.name: getAppVersionInfo:Gets the version information for the application. + * @tc.desc: Check the return type of the interface (by Callback) + * @tc.level 0 + */ + it('context_getAppVersionInfo_test_0200', 0, async function (done) { + try { + console.info('[context_getAppVersionInfo_test_0200] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.getAppVersionInfo((error, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getAppVersionInfo_test_0200', timeOldStamp, timeNewStamp); + console.info('[context_getAppVersionInfo_test_0200] data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("object"); + }); + } + catch (error) { + console.error('[context_getAppVersionInfo_test_0200] failed: ' + JSON.stringify(error)); + } + var callback = await context.getAppVersionInfo(); + console.info('---[context_getAppVersionInfo_test_0200] check---'); + checkAppVersionInfo('context_getAppVersionInfo_test_0200', callback); + console.info('[context_getAppVersionInfo_test_0200] FINISH'); + done(); + }); + + function checkAppVersionInfo(msg, data) { + console.log(msg + "checkAppVersionInfo start : " + JSON.stringify(data)); + console.log(msg + "checkAppVersionInfo appName : " + data.appName); + console.log(msg + "checkAppVersionInfo versionCode : " + data.versionCode); + console.log(msg + "checkAppVersionInfo versionName : " + data.versionName); + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.appName)).assertEqual("string"); + expect(typeof (data.versionCode)).assertEqual("number"); + expect(typeof (data.versionName)).assertEqual("string"); + expect(data.appName).assertEqual(""); + expect(data.versionCode).assertEqual(1000000); + expect(data.versionName).assertEqual("1.0.0"); + console.log(msg + "---checkAppVersionInfo End--- "); + } + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..915bf9f235cac0c1b34817b2f5d7afd6dcbea30b --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, it, expect} from 'hypium/index'; +import Utils from './Utils'; +import ability_featureAbility from '@ohos.ability.featureAbility'; + +export default function getHapModuleInfoJsunit() { + describe('appInfoTest_ability_4', function () { + /** + * @tc.number: context_getApplicationContext_test_0100 + * @tc.name: getApplicationContext:Gets the application context information. + * @tc.desc: Check the return value of the interface + * @tc.level 0 + */ + it('context_getApplicationContext_test_0100', 0, async function (done) { + try { + console.info('[context_getApplicationContext_test_0100] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext().getApplicationContext(); + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getApplicationContext_test_0100', timeOldStamp, timeNewStamp); + console.info('[context_getApplicationContext_test_0100] data is:' + JSON.stringify(context)); + } + catch (error) { + console.error('[context_getApplicationContext_test_0100] failed:' + JSON.stringify(error)); + } + expect(typeof (context)).assertEqual("object"); + console.info('[context_getApplicationContext_test_0100] FINISH'); + done(); + }); + + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..df1ef556ff20ed48cb67c6daa2c955ef6affffc8 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets @@ -0,0 +1,233 @@ +/** + * 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 {describe, it, expect} from 'hypium/index'; +import Utils from './Utils'; +import ability_featureAbility from '@ohos.ability.featureAbility'; + +export default function getHapModuleInfoJsunit() { + describe('appInfoTest_ability_6', function () { + /** + * @tc.number: context_getHapModuleInfo_test_0100 + * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application. + * @tc.desc: Check the return type of the interface (by Promise) + * @tc.level 0 + */ + it('context_getHapModuleInfo_test_0100', 0, async function (done) { + console.info('[context_getHapModuleInfo_test_0100] START'); + await Utils.sleep(1000); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.getHapModuleInfo() + .then((data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getHapModuleInfo_test_0100', timeOldStamp, timeNewStamp); + console.info('[context_getHapModuleInfo_test_0100] data is:' + JSON.stringify(data)); + expect(typeof (data)).assertEqual("object"); + }) + .catch((error) => { + console.error('[context_getHapModuleInfo_test_0100] failed:' + JSON.stringify(error)); + }) + var promise = await context.getHapModuleInfo(); + console.info('---[context_getHapModuleInfo_test_0100] check---'); + checkHapModuleInfo('context_getHapModuleInfo_test_0100', promise); + console.info('[context_getHapModuleInfo_test_0100] FINISH'); + done(); + }); + + /** + * @tc.number: context_getHapModuleInfo_test_0200 + * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application. + * @tc.desc: Check the return type of the interface (by Callback) + * @tc.level 0 + */ + it('context_getHapModuleInfo_test_0200', 0, async function (done) { + let callback; + try { + console.info('[context_getHapModuleInfo_test_0200] START'); + var timeOldStamp = await Utils.getNowTime(); + var context = ability_featureAbility.getContext(); + context.getHapModuleInfo((error, data) => { + var timeNewStamp = Utils.getNowTime(); + Utils.getDurationTime('context_getHapModuleInfo_test_0200', timeOldStamp, timeNewStamp); + console.info('[context_getHapModuleInfo_test_0200] data is:' + JSON.stringify(data)); + callback = data; + expect(typeof (data)).assertEqual("object"); + }); + } catch (error) { + console.error('[context_getHapModuleInfo_test_0200] failed: ' + JSON.stringify(error)); + } + await Utils.sleep(1000); + console.info('---[context_getHapModuleInfo_test_0200] check---'); + checkHapModuleInfo('context_getHapModuleInfo_test_0200', callback); + console.info('[context_getHapModuleInfo_test_0200] FINISH'); + done(); + }); + + function checkHapModuleInfo(msg, data) { + console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data)); + console.log(msg + "checkHapModuleInfo name : " + data.name); + console.log(msg + "checkHapModuleInfo description : " + data.description); + console.log(msg + "checkHapModuleInfo descriptionId : " + data.descriptionId); + console.log(msg + "checkHapModuleInfo icon : " + data.icon); + console.log(msg + "checkHapModuleInfo label : " + data.label); + console.log(msg + "checkHapModuleInfo labelId : " + data.labelId); + console.log(msg + "checkHapModuleInfo iconId : " + data.iconId); + console.log(msg + "checkHapModuleInfo backgroundImg : " + data.backgroundImg); + console.log(msg + "checkHapModuleInfo supportedModes : " + data.supportedModes); + console.log(msg + "checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); + for (var j = 0; j < data.reqCapabilities.length; j++) { + console.log(msg + "getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); + } + console.log(msg + "checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); + for (var k = 0; k < data.deviceTypes.length; k++) { + console.log(msg + "getHapModuleInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); + } + console.log(msg + "checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length); + console.log(msg + "checkHapModuleInfo moduleName : " + data.moduleName); + console.log(msg + "checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); + console.log(msg + "checkHapModuleInfo installationFree : " + data.installationFree); + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("number"); + expect(typeof (data.iconId)).assertEqual("number"); + expect(typeof (data.backgroundImg)).assertEqual("string"); + expect(typeof (data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.reqCapabilities)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.abilityInfos)).assertEqual(true); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.mainAbilityName)).assertEqual("string"); + expect(typeof (data.installationFree)).assertEqual("boolean"); + expect(data.name).assertEqual("com.ohos.acecollaboration"); + expect(data.description).assertEqual(""); + expect(data.descriptionId).assertEqual(0); + expect(data.icon).assertEqual("$media:icon"); + expect(data.label).assertEqual("$string:entry_MainAbility"); + expect(data.labelId).assertEqual(0); + expect(data.iconId).assertEqual(0); + expect(data.backgroundImg).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + expect(data.deviceTypes[0]).assertEqual("phone"); + checkAbilityInfo(msg,data.abilityInfos[0]); + expect(data.moduleName).assertEqual("entry") + expect(data.mainAbilityName).assertEqual(""); + expect(data.installationFree).assertEqual(false); + console.log(msg + "---checkHapModuleInfo End---"); + } + + function checkAbilityInfo(msg,data) { + console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data)); + console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName); + console.log(msg+ "checkAbilityInfo name : " + data.name); + console.log(msg+ "checkAbilityInfo label : " + data.label); + console.log(msg+ "checkAbilityInfo description : " + data.description); + console.log(msg+ "checkAbilityInfo icon : " + data.icon); + console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId); + console.log(msg+ "checkAbilityInfo iconId : " + data.iconId); + console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName); + console.log(msg+ "checkAbilityInfo process : " + data.process); + console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility); + console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes); + console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible); + console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled); + console.log(msg+ "checkAbilityInfo type : " + data.type) + console.log(msg+ "checkAbilityInfo orientation : " + data.orientation); + console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode); + console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length); + for (var j = 0; j < data.permissions.length; j++) { + console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); + } + console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); + for (var k = 0; k < data.deviceTypes.length; k++) { + console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]); + } + console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); + for (var i = 0; i < data.deviceCapabilities.length; i++) { + console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]); + } + console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission); + console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission); + console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity); + console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight); + console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); + console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth); + console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); + console.log(msg+ "checkAbilityInfo uri : " + data.uri); + console.log(msg+ "checkAbilityInfo labelId : " + data.labelId); + console.log(msg+ "checkAbilityInfo subType : " + data.subType); + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.bundleName)).assertEqual("string"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("number"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.iconId)).assertEqual("number"); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.process)).assertEqual("string"); + expect(typeof (data.targetAbility)).assertEqual("string"); + expect(typeof (data.backgroundModes)).assertEqual("number"); + expect(typeof (data.isVisible)).assertEqual("boolean"); + expect(typeof (data.formEnabled)).assertEqual("boolean"); + expect(typeof (data.type)).assertEqual("number"); + expect(typeof (data.subType)).assertEqual("number"); + expect(typeof (data.orientation)).assertEqual("number"); + expect(typeof (data.launchMode)).assertEqual("number"); + expect(Array.isArray(data.permissions)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); + expect(typeof (data.readPermission)).assertEqual("string"); + expect(typeof (data.writePermission)).assertEqual("string"); + expect(typeof (data.applicationInfo)).assertEqual("object"); + expect(typeof (data.formEntity)).assertEqual("number"); + expect(typeof (data.minFormHeight)).assertEqual("number"); + expect(typeof (data.defaultFormHeight)).assertEqual("number"); + expect(typeof (data.minFormWidth)).assertEqual("number"); + expect(typeof (data.defaultFormWidth)).assertEqual("number"); + expect(typeof (data.uri)).assertEqual("string"); + expect(data.bundleName).assertEqual("com.ohos.acecollaboration"); + expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility"); + expect(data.label).assertEqual("$string:entry_MainAbility"); + expect(data.description).assertEqual("$string:mainability_description"); + expect(data.icon).assertEqual("$media:icon"); + expect(data.moduleName).assertEqual("entry"); + expect(data.process).assertEqual(""); + expect(data.targetAbility).assertEqual(""); + expect(data.backgroundModes).assertEqual(0); + expect(data.isVisible).assertEqual(true); + expect(data.formEnabled).assertEqual(false); + expect(data.type).assertEqual(1); + expect(data.orientation).assertEqual(0); + expect(data.launchMode).assertEqual(1); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.readPermission).assertEqual(""); + expect(data.writePermission).assertEqual(""); + expect(data.formEntity).assertEqual(0); + expect(data.minFormHeight).assertEqual(0); + expect(data.defaultFormHeight).assertEqual(0); + expect(data.minFormWidth).assertEqual(0); + expect(data.defaultFormWidth).assertEqual(0); + expect(data.uri).assertEqual(""); + expect(data.subType).assertEqual(0); + console.log(msg+ "---checkAbilityInfo End--- "); + } + + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2a4a2f9f0d6cc7c4ccb42140aa8f2d8c16e75273 --- /dev/null +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,56 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + }, + { + "name": "description_serviceability2", + "value": "hap sample empty service" + }, + { + "name": "description_serviceability3", + "value": "hap sample empty service" + }, + { + "name": "description_serviceability4", + "value": "hap sample empty service" + }, + { + "name": "description_serviceability5", + "value": "hap sample empty service" + }, + { + "name": "description_mainability2", + "value": "eTS_Empty Ability2" + }, + { + "name": "entry_MainAbility2", + "value": "MainAbility2" + }, + { + "name": "description_serviceability6", + "value": "hap sample empty service" + }, + { + "name": "description_serviceability7", + "value": "hap sample empty service" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsabilitymanageretstest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsabilitymanageretstest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsabilitymanageretstest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/BUILD.gn b/ability/ability_runtime/actscalltest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/BUILD.gn rename to ability/ability_runtime/actscalltest/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/AppScope/app.json b/ability/ability_runtime/actscalltest/systemappcalleea/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/AppScope/app.json rename to ability/ability_runtime/actscalltest/systemappcalleea/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcalleea/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcalleea/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/systemappcalleea/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/systemappcalleea/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/BUILD.gn b/ability/ability_runtime/actscalltest/systemappcalleea/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/BUILD.gn rename to ability/ability_runtime/actscalltest/systemappcalleea/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/Test.json b/ability/ability_runtime/actscalltest/systemappcalleea/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/Test.json rename to ability/ability_runtime/actscalltest/systemappcalleea/Test.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0f77555b9fae8b1970fb42a61a82b8a3141877c --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,125 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCalleeA MainAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA SecondAbility Call_Finish<======') + }) + + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCalleeA MainAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class SecondAbility extends Ability { + test2200(data) { + console.log("SystemAppCalleeA SecondAbility test2200"); + let recvData = new MySequenceable(0, '', ''); + data.readSequenceable(recvData); + let result = new MySequenceable(recvData.num + 1, recvData.str + "SystemAppCalleeA", ''); + return result; + } + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemAppCalleeA SecondAbility onCreate") + globalThis.abilityWant = want; + globalThis.abilityContext2 = this.context; + this.callee.on('test2200', this.test2200); + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemAppCalleeA SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemAppCalleeA SecondAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemAppCalleeA SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemAppCalleeA SecondAbility onForeground"); + } + + onBackground() { + // Ability has back to background + console.log("SystemAppCalleeA SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/ThirdAbility/ThirdAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5fe516ffb0539e304ff8a7917656f867e73bbfb3 --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/ThirdAbility/ThirdAbility.ts @@ -0,0 +1,116 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCallerA MainAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA SecondAbility Call_Finish<======') + }) + + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCallerA MainAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class ThirdAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemAppCalleeA ThirdAbility onCreate") + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + globalThis.abilityWant = want; + globalThis.abilityContext3 = this.context; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemAppCalleeA ThirdAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemAppCalleeA ThirdAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemAppCalleeA ThirdAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemAppCalleeA ThirdAbility onForeground"); + } + + onBackground() { + // Ability has back to background + console.log("SystemAppCalleeA ThirdAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcalleea/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemappcalleea/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcalleea/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/systemappcalleea/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/AppScope/app.json b/ability/ability_runtime/actscalltest/systemappcallera/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/AppScope/app.json rename to ability/ability_runtime/actscalltest/systemappcallera/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcallera/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcallera/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/systemappcallera/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/systemappcallera/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/BUILD.gn b/ability/ability_runtime/actscalltest/systemappcallera/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/BUILD.gn rename to ability/ability_runtime/actscalltest/systemappcallera/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/Test.json b/ability/ability_runtime/actscalltest/systemappcallera/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/Test.json rename to ability/ability_runtime/actscalltest/systemappcallera/Test.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f341cffce6df6944696e810e129308726440188f --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,126 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCallerA SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA SecondAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCallerA SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemAppCallerA SecondAbility onCreate") + globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemAppCallerA SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemAppCallerA SecondAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemAppCallerA SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemAppCallerA SecondAbility onForeground"); + if ((globalThis.abilityWant.parameters.case_num == "case0700") || + (globalThis.abilityWant.parameters.case_num == "case0800")) { + console.log("SystemAppCallerA SecondAbility special process in"); + var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; + var commonEventData = { + data: publishData, + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>SystemAppCallerA SecondAbility Call_Finish<======') + }) + } + } + + onBackground() { + // Ability has back to background + console.log("SystemAppCallerA SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/ThirdAbility/ThirdAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f17f742f548f280c4e7f86103610d2daa55258e --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/ThirdAbility/ThirdAbility.ts @@ -0,0 +1,125 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCallerA ThirdAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA ThirdAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemAppCallerA ThirdAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class ThirdAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemAppCallerA ThirdAbility onCreate") + globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemAppCallerA ThirdAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemAppCallerA ThirdAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemAppCallerA ThirdAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemAppCallerA ThirdAbility onForeground"); + if ((globalThis.abilityWant.parameters.case_num == "case0700") || + (globalThis.abilityWant.parameters.case_num == "case0800")) { + var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; + var commonEventData = { + data: publishData, + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>SystemAppCallerA ThirdAbility Call_Finish<======') + }) + } + } + + onBackground() { + // Ability has back to background + console.log("SystemAppCallerA ThirdAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallera/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemappcallera/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallera/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/systemappcallera/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/AppScope/app.json b/ability/ability_runtime/actscalltest/systemappcallerb/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/AppScope/app.json rename to ability/ability_runtime/actscalltest/systemappcallerb/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcallerb/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcallerb/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/systemappcallerb/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/systemappcallerb/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/BUILD.gn b/ability/ability_runtime/actscalltest/systemappcallerb/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/BUILD.gn rename to ability/ability_runtime/actscalltest/systemappcallerb/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/Test.json b/ability/ability_runtime/actscalltest/systemappcallerb/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/Test.json rename to ability/ability_runtime/actscalltest/systemappcallerb/Test.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerb/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemappcallerb/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerb/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/systemappcallerb/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/AppScope/app.json b/ability/ability_runtime/actscalltest/systemappcallerc/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/AppScope/app.json rename to ability/ability_runtime/actscalltest/systemappcallerc/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcallerc/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcallerc/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/systemappcallerc/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/systemappcallerc/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/BUILD.gn b/ability/ability_runtime/actscalltest/systemappcallerc/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/BUILD.gn rename to ability/ability_runtime/actscalltest/systemappcallerc/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/Test.json b/ability/ability_runtime/actscalltest/systemappcallerc/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/Test.json rename to ability/ability_runtime/actscalltest/systemappcallerc/Test.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/systemappcallerc/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemappcallerc/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemappcallerc/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/systemappcallerc/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/AppScope/app.json b/ability/ability_runtime/actscalltest/systemcallentrytest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/AppScope/app.json rename to ability/ability_runtime/actscalltest/systemcallentrytest/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemcallentrytest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemcallentrytest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/systemcallentrytest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/systemcallentrytest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/BUILD.gn b/ability/ability_runtime/actscalltest/systemcallentrytest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/BUILD.gn rename to ability/ability_runtime/actscalltest/systemcallentrytest/BUILD.gn diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/Test.json b/ability/ability_runtime/actscalltest/systemcallentrytest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..87ac89c4f63fc417d0c27cf4fb4831130b95ae32 --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/Test.json @@ -0,0 +1,30 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.systemcalltest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsCallTestEntryTest.hap", + "ActsCallTestFeatureRelyHap.hap", + "ActsSystemAppCallerARelyHap.hap", + "ActsSystemAppCallerBRelyHap.hap", + "ActsSystemAppCallerCRelyHap.hap", + "ActsSystemAppCalleeARelyHap.hap", + "ActsThirdAppARelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ea84282ba560a8efd2656ee3e120d38c7e60717 --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,253 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +var callerA = "SystemAppCallerA" +var callSeqA= new Array(); +var callerB = "SystemAppCallerB" +var callSeqB= new Array(); +var callerC = "SystemAppCallerC" +var callSeqC= new Array(); +var seq = 0; + +function isArrayEqual(a1, a2) { + return a1.length==a2.length && a1.every(function(value,index) { return value === a2[index]}); +} +function isArrayEqualWithoutOrder(a1, a2) { + if (a1.length != a2.length) { + return false; + } + for (let ind in a1) { + if (a2.indexOf(a1[ind]) == -1) { + return false; + }; + } + return true; +} +var expectStressResult=[0,1,2,3,4,5,6,7,8,9]; + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA SecondAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCall2(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed2'; + var commonEventData = { + code: 0, + data: 'calleeCheckCall2Param', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA SecondAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +function test2100ReleaseCallback(data) { + console.log('SystemCallTest SecondAbility test2100ReleaseCallback:' + data); + test2100ReleaseFlag = data.toString(); +} + +var test2100ReleaseFlag = ''; + +export default class SecondAbility extends Ability { + + test2100(data) { + let recvData = new MySequenceable(0, '', ''); + data.readSequenceable(recvData); + let want = { + bundleName: "com.example.systemcalltest", + abilityName: "com.example.systemcalltest.MainAbility", + }; + console.log("SystemCallTest SecondAbility test2100 before startAbilityByCall"); + let resultData = new MySequenceable(0, '', ''); + globalThis.abilityContext2.startAbilityByCall(want).then((caller) => { + let param = new MySequenceable(recvData.num + 1, recvData.str + "Second", recvData.result); + caller.onRelease(test2100ReleaseCallback); + for (let start=Date.now(); Date.now() - start <= 200;); + caller.callWithResult('test2100', param).then((data2) => { + data2.readSequenceable(resultData); + caller.release(); + for (let start=Date.now(); Date.now() - start <= 200;); + resultData.result = test2100ReleaseFlag; + let commonEventData = { + parameters: { + num: resultData.num, + str: resultData.str, + result: resultData.result, + } + }; + commonEvent.publish('call_case2100_test_result', commonEventData, (err) => { + console.log('SystemCallTest SecondAbility publish call_case2200_test_result event'); + }) + + }); + }); + return resultData; + } + + testOff(data) { + let recvSequence = new MySequenceable(0, '', ''); + data.readSequenceable(recvSequence); + return recvSequence; + } + + stressMethod(data) { + let recvData = new MySequenceable(0, '', ''); + data.readSequenceable(recvData); + console.log('SystemCallTest SecondAbility stressMethod caller ' + recvData.str); + if (recvData.str == callerA) { + callSeqA.push(recvData.num); + } else if (recvData.str == callerB) { + callSeqB.push(recvData.num); + } else if (recvData.str == callerC) { + callSeqC.push(recvData.num); + } + seq++; + if (seq >= 30) { + console.log('SystemCallTest SecondAbility stressMethod SystemAppCallerA ' + callSeqA); + console.log('SystemCallTest SecondAbility stressMethod SystemAppCallerB ' + callSeqB); + console.log('SystemCallTest SecondAbility stressMethod SystemAppCallerC ' + callSeqC); + let stressResult=isArrayEqualWithoutOrder(callSeqA, expectStressResult); + stressResult=stressResult&&isArrayEqualWithoutOrder(callSeqB, expectStressResult); + stressResult=stressResult&&isArrayEqualWithoutOrder(callSeqC, expectStressResult); + console.log('SystemCallTest SecondAbility stressMethod stressResult ' + stressResult); + let commonEventData = { + data: stressResult.toString(), + }; + commonEvent.publish('com.example.systemcalltest.Test5600', commonEventData, (err) => { + console.log('SystemCallTest SecondAbility stress test result event'); + }); + seq=0; + callSeqA = []; + callSeqB = []; + callSeqC = []; + } + return recvData; + } + + loopMethod(data) { + let recvData = new MySequenceable(0, '', ''); + data.readSequenceable(recvData); + return new MySequenceable(recvData.num + 1, recvData.str, ''); + } + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemCallTest SecondAbility onCreate") + globalThis.abilityWant = want; + globalThis.secondCallee = this.callee; + globalThis.abilityContext2 = this.context; + this.callee.on('test2100', this.test2100); + this.callee.on('testOff', this.testOff); + this.callee.on('stressMethod', this.stressMethod); + this.callee.on('loopMethod', this.loopMethod); + this.callee.on('testCall', testCall); + this.callee.on('testCall2', testCall2); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemCallTest SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemCallTest SecondAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/second/second", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemCallTest SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemCallTest SecondAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("SystemCallTest SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7de8d97bf41542a2e9722f2953ad5739feffbd0e --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 10000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b8c0055ab5d9492f7dd370eafea98646cf3861f --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,1798 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +import missionManager from '@ohos.application.missionManager' +import appManager from '@ohos.application.appManager' + +const MAX_MISSION_NUM = 1024; +var sysABundleName = "com.example.systemcalltest"; +var sysAMainAbilityName = "com.example.systemcalltest.MainAbility"; +var sysASecondAbilityName = "com.example.systemcalltest.SecondAbility"; +var systemAppCallerABundleName = "com.example.systemappcallera"; +var systemAppCallerAMainAbilityName = "com.example.systemappcallera.MainAbility"; +var systemAppCallerASecondAbilityName = "com.example.systemappcallera.SecondAbility"; +var systemAppCallerAThirdAbilityName = "com.example.systemappcallera.ThirdAbility"; + +var systemAppCalleeABundleName = "com.example.systemappcalleea"; +var systemAppCalleeAMainAbilityName = "com.example.systemappcalleea.MainAbility"; +var systemAppCalleeASecondAbilityName = "com.example.systemappcalleea.SecondAbility"; +var systemAppCalleeAThirdAbilityName = "com.example.systemappcalleea.ThirdAbility"; + +var systemAppCalleeBBundleName = "com.example.systemappcalleeb"; +var systemAppCalleeBMainAbilityName = "com.example.systemappcalleeb.MainAbility"; +var systemAppCalleeBSecondAbilityName = "com.example.systemappcalleeb.SecondAbility"; + +var systemAppCalleeCBundleName = "com.example.systemappcalleec"; +var systemAppCalleeCMainAbilityName = "com.example.systemappcalleec.MainAbility"; +var systemAppCalleeCSecondAbilityName = "com.example.systemappcalleec.SecondAbility"; + +var thirdAppABundleName = "com.example.thirdappa"; +var thirdAppAMainAbilityName = "com.example.thirdappa.MainAbility"; +var subscriberInfo = { + events: ["CallTest"], +}; +var caseDepBundles = []; +var subscriber = null; + +class MySequenceable { + num: number = 0; + str: String = "default"; + result: String = "default"; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function getMissionId(abilityName, state) { + return new Promise(async (resolve, reject) => { + let missionId = -1; + let missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); + for (let i = 0; i < missionInfos.length; i++) { + if ((missionInfos[i].want.abilityName == abilityName) + && (missionInfos[i].runningState == state)) { + missionId = missionInfos[i].missionId; + break; + } + } + console.log('======>getMissionId resolve missionId<=======' + missionId); + resolve(missionId); + }) +} + +function delay(time) { + let delta; + if (typeof time != 'number' || time <= 0) { + delta = 100; + } else { + delta = Math.round(time); + } + for (let start = Date.now(); Date.now() - start <= delta; ); +} + +function clearDepProcess(bundleNames, callback, undoneCallBack) { + var result; + var cnt = 0; + + if (bundleNames.length == 0) { + undoneCallBack(); + } + for (let i = 0; i < bundleNames.length; i++) { + result = appManager.killProcessesByBundleName(bundleNames[i], (err, data) => { + console.log("clearDepProcess killProcessesByBundleName bundleName: " + bundleNames[i]); + console.log("clearDepProcess killProcessesByBundleName err: " + JSON.stringify(err)); + console.log("clearDepProcess killProcessesByBundleName data: " + JSON.stringify(data)); + cnt++; + if (cnt == bundleNames.length) { + callback(); + } + }); + } +} + +export default function abilityTest(abilityContext) { + describe('ActsAbilityTest', function () { + + beforeEach(async (done) => { + done(); + }) + + afterEach(async (done) => { + var testMissionId; + + if (subscriber != null) { + commonEvent.unsubscribe(subscriber, () => { + console.log('======>afterEach unsubscribe<======='); + }); + subscriber = null; + } + + testMissionId = await getMissionId(sysAMainAbilityName, 0); + console.log('======>afterEach test missionId<=======' + testMissionId); + if (testMissionId != -1) { + await missionManager.moveMissionToFront(testMissionId); + } + console.log('======>afterEach test missionId move to front<======='); + + clearDepProcess(caseDepBundles, () => { + caseDepBundles = []; + setTimeout(() => { + done(); + }, 500) + }, () => { + done(); + }); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0100 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0100', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0100 begin'); + + function unSubscribeCallBack() { + console.log('ACTS_CommonComponent_Call_0100 unSubscribeCallBack') + subscriber = null; + done(); + } + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0100 releaseCallBack' + data); + commonEvent.unsubscribe(subscriber, unSubscribeCallBack); + } + + function subscribeCallBack(err, data) { + console.log('ACTS_CommonComponent_Call_0100 subscribeCallBack data:' + JSON.stringify(data)) + expect(data.data).assertEqual('calleeCheckCallParam'); + expect(data.parameters.num).assertEqual(100); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0100'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0100processed'); + console.log('AMS_CallTest_0100 do release'); + caller.release(); + } + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, subscribeCallBack); + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(100, "ACTS_CommonComponent_Call_0100", 'default'); + caller.call('testCall', param).then(() => { + console.log('ACTS_CommonComponent_Call_0100 call success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0100 call exception' + err); + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0200 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0200', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0200 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0200 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(200, "ACTS_CommonComponent_Call_0200", 'default'); + caller.callWithResult('testCallWithResult', param).then((data) => { + console.log('ACTS_CommonComponent_Call_0200 call success'); + var result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.num).assertEqual(200); + expect(result.str).assertEqual('ACTS_CommonComponent_Call_0200'); + expect(result.result).assertEqual('ACTS_CommonComponent_Call_0200processed'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0200 call exception' + err); + expect().assertFail(); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0300 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0300', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0300 begin'); + caseDepBundles = [systemAppCalleeABundleName]; + + function unSubscribeCallBack() { + console.log('ACTS_CommonComponent_Call_0300 unSubscribeCallBack') + subscriber = null; + done(); + } + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0300 releaseCallBack' + data); + commonEvent.unsubscribe(subscriber, unSubscribeCallBack); + } + + function subscribeCallBack(err, data) { + console.log('ACTS_CommonComponent_Call_0300 subscribeCallBack data:' + JSON.stringify(data)) + expect(data.data).assertEqual('calleeCheckCallParam'); + expect(data.parameters.num).assertEqual(300); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0300'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0300processed'); + console.log('ACTS_CommonComponent_Call_0300 do release'); + caller.release(); + } + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, subscribeCallBack); + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeAMainAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(300, "ACTS_CommonComponent_Call_0300", 'default'); + caller.call('testCall', param).then(() => { + console.log('ACTS_CommonComponent_Call_0300 call success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0300 call exception' + err); + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0400 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0400', 0, async function (done) { + caseDepBundles = [systemAppCalleeABundleName]; + console.log('ACTS_CommonComponent_Call_0400 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0400 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeAMainAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(400, "ACTS_CommonComponent_Call_0400", 'default'); + caller.callWithResult('testCallWithResult', param).then((data) => { + console.log('ACTS_CommonComponent_Call_0400 call success'); + var result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.num).assertEqual(400); + expect(result.str).assertEqual('ACTS_CommonComponent_Call_0400'); + expect(result.result).assertEqual('ACTS_CommonComponent_Call_0400processed'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0400 call exception' + err); + expect().assertFail(); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0500 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0500', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0500 begin'); + var caller1; + var caller2; + caseDepBundles = [systemAppCalleeABundleName]; + + function unSubscribeCallBack() { + console.log('ACTS_CommonComponent_Call_0500 unSubscribeCallBack') + subscriber = null; + caller1.release(); + done(); + } + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0500 releaseCallBack' + data); + commonEvent.unsubscribe(subscriber, unSubscribeCallBack); + } + + function subscribeCallBack(err, data) { + console.log('ACTS_CommonComponent_Call_0500 subscribeCallBack data:' + JSON.stringify(data)) + expect(data.data).assertEqual('calleeCheckCallParam'); + expect(data.parameters.num).assertEqual(500); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0500'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0500processed'); + console.log('ACTS_CommonComponent_Call_0500 do release'); + caller2.release(); + } + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, subscribeCallBack); + + caller1 = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeAMainAbilityName, + }); + + caller2 = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeASecondAbilityName, + }); + + caller2.onRelease(releaseCallback); + let param = new MySequenceable(500, "ACTS_CommonComponent_Call_0500", 'default'); + caller2.call('testCall', param).then(() => { + console.log('ACTS_CommonComponent_Call_0500 call success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0500 call exception' + err); + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0600 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0600', 0, async function (done) { + caseDepBundles = [systemAppCalleeABundleName]; + console.log('ACTS_CommonComponent_Call_0600 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0600 releaseCallBack' + data); + caller1.release(); + done(); + } + + let caller1 = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeAMainAbilityName, + }); + let caller2 = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeASecondAbilityName, + }); + + caller2.onRelease(releaseCallback); + let param = new MySequenceable(600, "ACTS_CommonComponent_Call_0600", 'default'); + caller2.callWithResult('testCallWithResult', param).then((data) => { + console.log('ACTS_CommonComponent_Call_0600 call success'); + var result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.num).assertEqual(600); + expect(result.str).assertEqual('ACTS_CommonComponent_Call_0600'); + expect(result.result).assertEqual('ACTS_CommonComponent_Call_0600processed'); + caller2.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0600 call exception' + err); + expect().assertFail(); + caller2.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0700 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0700', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0700 begin'); + var caller; + caseDepBundles = [systemAppCalleeABundleName]; + + function unSubscribeCallBack() { + console.log('ACTS_CommonComponent_Call_0700 unSubscribeCallBack') + subscriber = null; + done(); + } + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0700 releaseCallBack' + data); + commonEvent.unsubscribe(subscriber, unSubscribeCallBack); + } + + function releaseCallback1(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0700 releaseCallBack1' + data); + setTimeout(() => { + globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeASecondAbilityName, + }).then(data => { + caller = data; + console.log('ACTS_CommonComponent_Call_0700 caller get') + caller.onRelease(releaseCallback); + let param = new MySequenceable(700, "ACTS_CommonComponent_Call_0700", 'default'); + caller.call('testCall', param).then(() => { + console.log('ACTS_CommonComponent_Call_0700 call success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0700 call exception' + err); + expect().assertFail(); + }) + }) + }, 100); + } + + function subscribeCallBack(err, data) { + console.log('ACTS_CommonComponent_Call_0700 subscribeCallBack data:' + JSON.stringify(data)) + expect(data.data).assertEqual('calleeCheckCallParam'); + expect(data.parameters.num).assertEqual(700); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0700'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0700processed'); + console.log('ACTS_CommonComponent_Call_0700 do release'); + caller.release(); + } + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, subscribeCallBack); + + globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeASecondAbilityName, + }).then(data => { + caller = data; + console.log('ACTS_CommonComponent_Call_0700 caller get') + caller.onRelease(releaseCallback1); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0800 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0800', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0800 begin'); + var caller; + caseDepBundles = [systemAppCalleeABundleName]; + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0800 releaseCallBack' + data); + done(); + } + + function releaseCallback1(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0800 releaseCallBack' + data); + setTimeout(() => { + globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeASecondAbilityName, + }).then(data => { + caller = data; + caller.onRelease(releaseCallback); + let param = new MySequenceable(800, "ACTS_CommonComponent_Call_0800", 'default'); + caller.callWithResult('testCallWithResult', param).then((data) => { + console.log('ACTS_CommonComponent_Call_0800 call success'); + var result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.num).assertEqual(800); + expect(result.str).assertEqual('ACTS_CommonComponent_Call_0800'); + expect(result.result).assertEqual('ACTS_CommonComponent_Call_0800processed'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0800 call exception' + err); + expect().assertFail(); + caller.release(); + }) + }); + }, 100); + } + + globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeASecondAbilityName, + }).then(data => { + caller = data; + console.log('ACTS_CommonComponent_Call_0800 caller get') + caller.onRelease(releaseCallback1); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_0900 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_0900', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_0900 begin'); + caseDepBundles = [thirdAppABundleName]; + var caller; + + function unSubscribeCallBack() { + console.log('ACTS_CommonComponent_Call_0900 unSubscribeCallBack') + subscriber = null; + done(); + } + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_0900 releaseCallBack' + data); + commonEvent.unsubscribe(subscriber, unSubscribeCallBack); + } + + function subscribeCallBack(err, data) { + console.log('ACTS_CommonComponent_Call_0900 subscribeCallBack data:' + JSON.stringify(data)) + expect(data.data).assertEqual('calleeCheckCallParam'); + expect(data.parameters.num).assertEqual(900); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0900'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0900processed'); + console.log('AMS_CallTest_0100 do release'); + caller.release(); + } + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, subscribeCallBack); + caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: thirdAppABundleName, + abilityName: thirdAppAMainAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(900, "ACTS_CommonComponent_Call_0900", 'default'); + caller.call('testCall', param).then(() => { + console.log('ACTS_CommonComponent_Call_0900 call success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_0900 call exception' + err); + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_1000 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_1000', 0, async function (done) { + caseDepBundles = [thirdAppABundleName]; + console.log('ACTS_CommonComponent_Call_1000 begin'); + var caller; + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_1000 releaseCallBack' + data); + done(); + } + + caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: thirdAppABundleName, + abilityName: thirdAppAMainAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(1000, "ACTS_CommonComponent_Call_1000", 'default'); + caller.callWithResult('testCallWithResult', param).then((data) => { + console.log('ACTS_CommonComponent_Call_1000 call success'); + var result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.num).assertEqual(1000); + expect(result.str).assertEqual('ACTS_CommonComponent_Call_1000'); + expect(result.result).assertEqual('ACTS_CommonComponent_Call_1000processed'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_1000 call exception' + err); + expect().assertFail(); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_1700 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_1700', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_1700 begin'); + var caller; + var exceptionFlag = false; + + try { + caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeAThirdAbilityName, + }); + } catch(err) { + console.log('ACTS_CommonComponent_Call_1700 exception' + err); + exceptionFlag = true; + expect(err.message).assertEqual("function request remote error"); + } + expect(exceptionFlag).assertEqual(true); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_1900 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_1900', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_1900 begin'); + var callBackCnt = 0; + + function checkFinish() { + if (callBackCnt >= 3) { + console.log('ACTS_CommonComponent_Call_1900 finish release') + caller.release(); + } + } + + function unSubscribeCallBack() { + console.log('ACTS_CommonComponent_Call_1900 unSubscribeCallBack') + subscriber = null; + done(); + } + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_1900 releaseCallBack' + data); + commonEvent.unsubscribe(subscriber, unSubscribeCallBack); + } + + function subscribeCallBack(err, data) { + console.log('ACTS_CommonComponent_Call_1900 subscribeCallBack data:' + JSON.stringify(data)) + if (data.data == 'calleeCheckCallParam') { + expect(data.parameters.num).assertEqual(1900); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed'); + callBackCnt++; + checkFinish(); + } else if (data.data == 'calleeCheckCall2Param') { + expect(data.parameters.num).assertEqual(1900); + expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900'); + expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed2'); + callBackCnt++; + checkFinish(); + } + } + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, subscribeCallBack); + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(1900, "ACTS_CommonComponent_Call_1900", 'default'); + caller.call('testCall', param).then(() => { + console.log('ACTS_CommonComponent_Call_1900 call success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_1900 call exception' + err); + expect().assertFail(); + }) + caller.call('testCall2', param).then(() => { + console.log('ACTS_CommonComponent_Call_1900 call2 success'); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_1900 call2 exception' + err); + expect().assertFail(); + }) + + caller.callWithResult('testCallWithResult', param).then((data) => { + console.log('ACTS_CommonComponent_Call_1900 call success'); + var result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.num).assertEqual(1900); + expect(result.str).assertEqual('ACTS_CommonComponent_Call_1900'); + expect(result.result).assertEqual('ACTS_CommonComponent_Call_1900processed'); + callBackCnt++; + checkFinish(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_1900 call exception' + err); + expect().assertFail(); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2000 + * @tc.name: The callee exits abnormally after the caller requests the call to be called successfully. + * @tc.desc: Verify that the caller can register the server's death listener. + */ + it('ACTS_CommonComponent_Call_2000', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2000 begin'); + + function releaseCallback(data) { + console.log('ACTS_CommonComponent_Call_2000 releaseCallBack:' + data); + expect(data).assertEqual("died"); + done(); + } + + let bundleNameCallee = "com.example.systemappcalleea"; + let abilityNameCallee = "com.example.systemappcalleea.MainAbility"; + let want = { + bundleName: bundleNameCallee, + abilityName: abilityNameCallee, + } + let caller = await globalThis.abilityContext.startAbilityByCall(want); + if (typeof caller !== "object" || caller == null) { + console.log('ACTS_CommonComponent_Call_2000 startAbilityByCall fail'); + expect().assertFail(); + } + try { + caller.onRelease(releaseCallback); + } catch (e) { + console.log('ACTS_CommonComponent_Call_2000 Caller onRelease fail ' + e); + expect().assertFail(); + } + await appManager.killProcessesByBundleName(bundleNameCallee); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2300 + * @tc.name: Callee is in standalone process AbilityStage of the same app. + * @tc.desc: Verify Callee is in standalone process AbilityStage of the same app. + */ + it('ACTS_CommonComponent_Call_2300', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2300 begin'); + + let bundleNameCallee = "com.example.systemcalltest"; + let abilityNameCallee = "com.example.second.MainAbility"; + + function releaseCallback(data) { + console.log('ACTS_CommonComponent_Call_2300 releaseCallBack:' + data); + expect(data).assertEqual("release"); + done(); + } + + let want = { + bundleName: bundleNameCallee, + abilityName: abilityNameCallee, + } + let caller = await globalThis.abilityContext.startAbilityByCall(want); + if (typeof caller !== "object" || caller == null) { + console.log('ACTS_CommonComponent_Call_2300 startAbilityByCall fail'); + expect().assertFail(); + done(); + } + + try { + caller.onRelease(releaseCallback); + } catch (e) { + console.log('ACTS_CommonComponent_Call_2300 Caller onRelease fail ' + e); + expect().assertFail(); + done(); + } + let param = new MySequenceable(2300, "case2300", 'default'); + caller.callWithResult('test2300', param).then((data) => { + console.log('ACTS_CommonComponent_Call_2300 callWithResult ' + JSON.stringify(data)); + let result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.str).assertEqual("onCreateonBackground"); + expect(result.num).assertEqual(0); + }); + + try { + caller.release(); + } catch (e) { + console.log('ACTS_CommonComponent_Call_2300 Caller Release fail:' + e); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2400 + * @tc.name: The service party cannot provide the corresponding service after calling Callee.off. + * @tc.desc: The verification service party cannot provide the corresponding service after calling Callee.off. + */ + it('ACTS_CommonComponent_Call_2400', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2400 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_2400 releaseCallBack ' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(2400, "case2400", 'default'); + let beforeOff = 0; + let afterOff = 0; + await caller.call('testOff', param).then(() => { + console.log('ACTS_CommonComponent_Call_2400 call success'); + beforeOff = 1; + }).catch(err => { + beforeOff = 2; + }) + + globalThis.secondCallee.off('testOff'); + + await caller.call('testOff', param).then(() => { + console.log('ACTS_CommonComponent_Call_2400 call success'); + afterOff = 1; + }).catch(err => { + afterOff = 2; + }) + + expect(beforeOff).assertEqual(1); + expect(afterOff).assertEqual(2); + caller.release(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2500 + * @tc.name: The parameter "method" of the Caller.call function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.call function is an empty string. + */ + it('ACTS_CommonComponent_Call_2500', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2500 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_2500 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(2500, "case2500", 'default'); + caller.call('', param).then(() => { + console.log('ACTS_CommonComponent_Call_2500 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_2500 call exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2600 + * @tc.name: The parameter "method" of the Caller.call function is null. + * @tc.desc: Verify that the parameter "method" of the Caller.call function is null. + */ + it('ACTS_CommonComponent_Call_2600', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2600 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_2600 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(2600, "case2600", 'default'); + caller.call(null, param).then(() => { + console.log('ACTS_CommonComponent_Call_2600 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_2600 call exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2700 + * @tc.name: The parameter "method" of the Caller.call function is undefined. + * @tc.desc: Verify that the parameter "method" of the Caller.call function is undefined. + */ + it('ACTS_CommonComponent_Call_2700', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2700 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_2700 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(2700, "case2700", 'default'); + caller.call(undefined, param).then(() => { + console.log('ACTS_CommonComponent_Call_2700 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_2700 call exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2800 + * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. + */ + it('ACTS_CommonComponent_Call_2800', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2800 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_2800 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(2800, "case2800", 'default'); + caller.callWithResult('', param).then((data) => { + console.log('ACTS_CommonComponent_Call_2800 callWithResult success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_2800 callWithResult exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_2900 + * @tc.name: The parameter "method" of the Caller.callWithResult function is null. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is null. + */ + it('ACTS_CommonComponent_Call_2900', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_2900 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_2900 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(2900, "case2900", 'default'); + caller.callWithResult(null, param).then((data) => { + console.log('ACTS_CommonComponent_Call_2900 callWithResult success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_2900 callWithResult exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3000 + * @tc.name: The parameter "method" of the Caller.callWithResult function is undefined. + * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is undefined. + */ + it('ACTS_CommonComponent_Call_3000', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3000 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_3000 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + caller.onRelease(releaseCallback); + let param = new MySequenceable(3000, "case3000", 'default'); + caller.callWithResult(undefined, param).then((data) => { + console.log('ACTS_CommonComponent_Call_3000 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_3000 catch exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3100 + * @tc.name: The parameter method of the Callee.on function is an empty string. + * @tc.desc: Verify that the parameter method of the Callee.on function is an empty string. + */ + it('ACTS_CommonComponent_Call_3100', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3100 begin'); + + function onTest(data) { + console.log('ACTS_CommonComponent_Call_3100 onTest'); + } + + let finishFlag = 0; + try { + globalThis.callee.on('', onTest); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3200 + * @tc.name: The parameter method of the Callee.on function is null. + * @tc.desc: Verify that the parameter method of the Callee.on function is null. + */ + it('ACTS_CommonComponent_Call_3200', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3200 begin'); + + function onTest(data) { + console.log('ACTS_CommonComponent_Call_3200 onTest'); + } + + let finishFlag = 0; + try { + globalThis.callee.on(null, onTest); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3300 + * @tc.name: The parameter method of the Caller.callWithResult function is undefined. + * @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined. + */ + it('ACTS_CommonComponent_Call_3300', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3300 begin'); + + function onTest(data) { + console.log('ACTS_CommonComponent_Call_3300 onTest'); + } + + let finishFlag = 0; + try { + globalThis.callee.on(undefined, onTest); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3400 + * @tc.name: The parameter "method" of the Callee.off function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string. + */ + it('ACTS_CommonComponent_Call_3400', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3400 begin'); + + let finishFlag = 0; + try { + globalThis.callee.off(''); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3500 + * @tc.name: The parameter "method" of the Callee.off function is null. + * @tc.desc: Verify that the parameter "method" of the Callee.off function is null. + */ + it('ACTS_CommonComponent_Call_3500', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3500 begin'); + + let finishFlag = 0; + try { + globalThis.callee.off(null); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_3600 + * @tc.name: The parameter “method” of the Callee.off function is undefined. + * @tc.desc: Verify that the parameter “method” of the Callee.off function is undefined. + */ + it('ACTS_CommonComponent_Call_3600', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3600 begin'); + + let finishFlag = 0; + try { + globalThis.callee.off(undefined); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3600 callee.off err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_3700 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_3700', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3700 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_3700 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + console.log('ACTS_CommonComponent_Call_3700 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_3700 before call') + caller.call('testCall', "").then(() => { + console.log('ACTS_CommonComponent_Call_3700 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_3700 catch exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_3800 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_3800', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3800 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_3800 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + console.log('ACTS_CommonComponent_Call_3800 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_3800 before call') + caller.call('testCall', null).then(() => { + console.log('ACTS_CommonComponent_Call_3800 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_3800 catch exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_3900 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_3900', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3900 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_3900 releaseCallBack' + data); + done(); + } + + let caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }); + + console.log('ACTS_CommonComponent_Call_3900 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_3900 before call') + caller.call('testCall', undefined).then(() => { + console.log('ACTS_CommonComponent_Call_3900 call success'); + caller.release(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_3900 catch exception' + err); + expect(err.message).assertEqual("function input parameter error"); + caller.release(); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4000 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4000', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4000 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_4000 release CallBack' + data); + done(); + } + + globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }).then((data) => { + let caller = data; + console.log('ACTS_CommonComponent_Call_4000 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_4000 before call') + caller.callWithResult('testCallWithResult', "").then((data) => { + console.log('ACTS_CommonComponent_Call_4000 call success'); + expect(data).assertEqual(undefined); + caller.release(); + }).catch((e) => { + console.log('ACTS_CommonComponent_Call_4000 call err' + e); + caller.release(); + }); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4100 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4100', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4100 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_4100 release CallBack' + data); + done(); + } + + globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }).then((data) => { + let caller = data; + console.log('ACTS_CommonComponent_Call_4100 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_4100 before call') + caller.callWithResult('testCallWithResult', null).then((data) => { + console.log('ACTS_CommonComponent_Call_4100 call success'); + expect(data).assertEqual(undefined); + caller.release(); + }).catch((e) => { + console.log('ACTS_CommonComponent_Call_4100 call err' + e); + caller.release(); + }); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4200 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4200', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4200 begin'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_4200 release CallBack' + data); + done(); + } + + globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }).then((data) => { + let caller = data; + console.log('ACTS_CommonComponent_Call_4200 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_4200 before call') + caller.callWithResult('testCallWithResult', undefined).then((data) => { + console.log('ACTS_CommonComponent_Call_4200 call success'); + expect(data).assertEqual(undefined); + caller.release(); + }).catch((e) => { + console.log('ACTS_CommonComponent_Call_4200 call err' + e); + caller.release(); + }); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4300 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4300', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4300 begin'); + let finishFlag = 0; + try { + globalThis.callee.on('testCall', ""); + } catch (err) { + console.log('ACTS_CommonComponent_Call_4300 call err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4400 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4400', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4400 begin'); + let finishFlag = 0; + try { + globalThis.callee.on('testCall', null); + } catch (err) { + console.log('ACTS_CommonComponent_Call_4400 call err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4500 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4500', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4500 begin'); + let finishFlag = 0; + try { + globalThis.callee.on('testCall', undefined); + } catch (err) { + console.log('ACTS_CommonComponent_Call_4500 call err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_4800 + * @tc.name: Callee is in standalone process AbilityStage of the same app. + * @tc.desc: Verify Callee is in standalone process AbilityStage of the same app. + */ + it('ACTS_CommonComponent_Call_4800', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4800 begin'); + + let bundleNameCallee = "com.example.systemcalltest"; + let abilityNameCallee = "com.example.second.MainAbility"; + + function releaseCallback(data) { + console.log('ACTS_CommonComponent_Call_4800 releaseCallBack:' + data); + expect(data).assertEqual("release"); + done(); + } + + let want = { + bundleName: bundleNameCallee, + abilityName: abilityNameCallee, + } + let caller = await globalThis.abilityContext.startAbilityByCall(want); + if (typeof caller !== "object" || caller == null) { + console.log('ACTS_CommonComponent_Call_4800 startAbilityByCall fail'); + expect().assertFail(); + done(); + } + + try { + caller.onRelease(releaseCallback); + } catch (e) { + console.log('ACTS_CommonComponent_Call_4800 Caller onRelease fail ' + e); + expect().assertFail(); + done(); + } + let param = new MySequenceable(4600, "case4600", 'default'); + caller.callWithResult('test4600', param).then((data) => { + let result = new MySequenceable(0, '', ''); + data.readSequenceable(result); + expect(result.str).assertEqual("onCreateonBackground"); + expect(result.num).assertEqual(0); + }); + + try { + caller.release(); + } catch (e) { + console.log('ACTS_CommonComponent_Call_4800 Caller Release fail:' + e); + expect().assertFail(); + done(); + } + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_4900 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_4900', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_4900 begin'); + let caller; + let sequenceable = new MySequenceable(1, 'ACTS_CommonComponent_Call_4900', 'default'); + + function releaseCallback(data) { + expect(data).assertEqual('release'); + console.log('ACTS_CommonComponent_Call_4900 releaseCallBack ' + data); + caller.call('testCall', sequenceable).then(() => { + console.log('ACTS_CommonComponent_Call_4900 call2 success'); + expect().assertFail(); + done(); + }).catch(err => { + console.log('ACTS_CommonComponent_Call_4900 call2 err ' + err); + expect(err.message).assertEqual("function inner object error"); + done(); + }) + } + + globalThis.abilityContext.startAbilityByCall({ + bundleName: sysABundleName, + abilityName: sysASecondAbilityName, + }).then((data) => { + caller = data; + console.log('ACTS_CommonComponent_Call_4900 before onRelease') + caller.onRelease(releaseCallback); + console.log('ACTS_CommonComponent_Call_4900 before call') + delay(100); + caller.call('testCall', sequenceable).then(() => { + console.log('ACTS_CommonComponent_Call_4900 call1 success'); + caller.release(); + }).catch((e) => { + console.log('ACTS_CommonComponent_Call_4900 call err' + e); + expect().assertFail(); + done(); + }); + }) + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_5000 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_5000', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5000 begin'); + let finishFlag = 0; + + function testCallback_5100() { + console.log('ACTS_CommonComponent_Call_5000 testCallback'); + } + + try { + globalThis.callee.on('ACTS_CommonComponent_Call_5000', testCallback_5100); + } catch (err) { + console.log('ACTS_CommonComponent_Call_5000 call err' + err); + expect().assertFail(); + globalThis.callee.off('ACTS_CommonComponent_Call_5000'); + done(); + } + try { + globalThis.callee.on('ACTS_CommonComponent_Call_5000', testCallback_5100); + } catch (err) { + console.log('ACTS_CommonComponent_Call_5000 call err' + err); + expect(err.message).assertEqual("function is registered"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + globalThis.callee.off('ACTS_CommonComponent_Call_5000'); + console.log('ACTS_CommonComponent_Call_5000 finished'); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_5100 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_5100', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5100 begin'); + let finishFlag = 0; + + function testCallback_5100() { + console.log('ACTS_CommonComponent_Call_5100 testCallback'); + } + + try { + globalThis.callee.on('ACTS_CommonComponent_Call_5100', testCallback_5100); + globalThis.callee.off('ACTS_CommonComponent_Call_5100'); + } catch (err) { + console.log('ACTS_CommonComponent_Call_5100 first step err' + err); + expect().assertFail(); + globalThis.callee.off('ACTS_CommonComponent_Call_5100'); + done(); + } + try { + globalThis.callee.off('ACTS_CommonComponent_Call_5100'); + } catch (err) { + console.log('ACTS_CommonComponent_Call_5100 call err' + err); + expect(err.message).assertEqual("function not registered"); + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + console.log('ACTS_CommonComponent_Call_5100 finished'); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_5200 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_5200', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5200 begin'); + let caller; + let exceptionFlag = false; + + try { + caller = await globalThis.abilityContext.startAbilityByCall(null); + console.log('ACTS_CommonComponent_Call_5200 startAbilityByCall' + JSON.stringify(caller)) + } catch(err) { + console.log('ACTS_CommonComponent_Call_5200 exception' + err); + exceptionFlag = true; + expect(err.message).assertEqual("function input parameter error"); + } + + expect(exceptionFlag).assertEqual(true); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_5300 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_5300', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5300 begin'); + let caller; + let exceptionFlag = false; + + try { + caller = await globalThis.abilityContext.startAbilityByCall({ + bundleName: "", + abilityName: "", + }); + console.log('ACTS_CommonComponent_Call_5300 startAbilityByCall' + JSON.stringify(caller)) + } catch(err) { + console.log('ACTS_CommonComponent_Call_5300 exception' + err); + exceptionFlag = true; + expect(err.message).assertEqual("function request remote error"); + } + + expect(exceptionFlag).assertEqual(true); + done(); + }) + + /* + * @tc.number: ACTS_CommonComponent_Call_5400 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('ACTS_CommonComponent_Call_5400', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5400 begin'); + let caller; + let exceptionFlag = false; + + try { + caller = await globalThis.abilityContext.startAbilityByCall(undefined); + console.log('ACTS_CommonComponent_Call_5400 startAbilityByCall' + JSON.stringify(caller)) + } catch(err) { + console.log('ACTS_CommonComponent_Call_5400 exception' + err); + exceptionFlag = true; + expect(err.message).assertEqual("function input parameter error"); + } + + expect(exceptionFlag).assertEqual(true); + done(); + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_5700 + * @tc.name: The mission of callee is not in recent list when startAbilityByCall only. + * @tc.desc: Verify the mission of callee is not in recent list when startAbilityByCall only. + */ + it('ACTS_CommonComponent_Call_5700', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5700 begin'); + + let bundleNameCallee = "com.example.systemcalltest"; + let abilityNameCallee = "com.example.systemcalltest.SecondAbility"; + let want = { + bundleName: bundleNameCallee, + abilityName: abilityNameCallee, + } + let caller = await globalThis.abilityContext.startAbilityByCall(want); + if (typeof caller !== "object" || caller == null) { + console.log('ACTS_CommonComponent_Call_5700 startAbilityByCall fail'); + expect().assertFail(); + done(); + } + + async function releaseCallback(data) { + console.log('ACTS_CommonComponent_Call_5700 releaseCallBack:' + data); + expect(data).assertEqual("release"); + + let missionId = await getMissionId(abilityNameCallee, 0); + expect(missionId == -1).assertTrue(); + done(); + } + + try { + caller.onRelease(releaseCallback); + } catch (e) { + console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e); + expect().assertFail(); + done(); + } + + try { + caller.release(); + } catch (e) { + console.log('ACTS_CommonComponent_Call_5700 Caller Release fail:' + e); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number: ACTS_CommonComponent_Call_5800 + * @tc.name: The mission of callee is in recent list when startAbilityByCall then startAbility. + * @tc.desc: Verify the mission of callee is in recent list when startAbilityByCall then startAbility. + */ + it('ACTS_CommonComponent_Call_5800', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_5800 begin'); + + let bundleNameCallee = "com.example.systemcalltest"; + let abilityNameCallee = "com.example.systemcalltest.SecondAbility"; + let want = { + bundleName: bundleNameCallee, + abilityName: abilityNameCallee, + } + let caller = await globalThis.abilityContext.startAbilityByCall(want); + if (typeof caller !== "object" || caller == null) { + console.log('ACTS_CommonComponent_Call_5800 startAbilityByCall fail'); + expect().assertFail(); + done(); + } + + function startAbilityCallback(err) { + console.log('ACTS_CommonComponent_Call_5800 startAbilityCallback'); + if (err.code != 0) { + expect().assertFail(); + done(); + } + } + + await globalThis.abilityContext.startAbility(want, startAbilityCallback); + + async function releaseCallback(data) { + console.log('ACTS_CommonComponent_Call_5800 releaseCallBack:' + data); + expect(data).assertEqual("release"); + + let missionId = await getMissionId(abilityNameCallee, 0); + expect(missionId != -1).assertTrue(); + done(); + } + try { + caller.onRelease(releaseCallback); + } catch (e) { + console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e); + expect().assertFail(); + done(); + } + + try { + caller.release(); + } catch (e) { + console.log('ACTS_CommonComponent_Call_5800 Caller Release fail:' + e); + expect().assertFail(); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallentrytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemcallentrytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallentrytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/systemcallentrytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/AppScope/app.json b/ability/ability_runtime/actscalltest/systemcallfeature/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/AppScope/app.json rename to ability/ability_runtime/actscalltest/systemcallfeature/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemcallfeature/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemcallfeature/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/systemcallfeature/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/systemcallfeature/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/BUILD.gn b/ability/ability_runtime/actscalltest/systemcallfeature/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/BUILD.gn rename to ability/ability_runtime/actscalltest/systemcallfeature/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/Test.json b/ability/ability_runtime/actscalltest/systemcallfeature/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/Test.json rename to ability/ability_runtime/actscalltest/systemcallfeature/Test.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/pages/index/index.ets diff --git a/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff7d4541726c5f8b893f51c4a01be570066c33a0 --- /dev/null +++ b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Second { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('SystemCallTest SecondAbility)') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/systemcallfeature/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemcallfeature/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/systemcallfeature/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/systemcallfeature/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/AppScope/app.json b/ability/ability_runtime/actscalltest/thirdappa/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/AppScope/app.json rename to ability/ability_runtime/actscalltest/thirdappa/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/thirdappa/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/thirdappa/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/thirdappa/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/thirdappa/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/BUILD.gn b/ability/ability_runtime/actscalltest/thirdappa/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/BUILD.gn rename to ability/ability_runtime/actscalltest/thirdappa/BUILD.gn diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/Test.json b/ability/ability_runtime/actscalltest/thirdappa/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/Test.json rename to ability/ability_runtime/actscalltest/thirdappa/Test.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/module.json b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/thirdappa/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdappa/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/thirdappa/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdappa/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/thirdappa/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/AppScope/app.json b/ability/ability_runtime/actscalltest/thirdcalltest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/AppScope/app.json rename to ability/ability_runtime/actscalltest/thirdcalltest/AppScope/app.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actscalltest/thirdcalltest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/thirdcalltest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actscalltest/thirdcalltest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actscalltest/thirdcalltest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/BUILD.gn b/ability/ability_runtime/actscalltest/thirdcalltest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/BUILD.gn rename to ability/ability_runtime/actscalltest/thirdcalltest/BUILD.gn diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/Test.json b/ability/ability_runtime/actscalltest/thirdcalltest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5ff5006bfa5d2a4d0c31ea2c50aa85784e28eed9 --- /dev/null +++ b/ability/ability_runtime/actscalltest/thirdcalltest/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "100000", + "package": "com.example.thirdcalltest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsThirdCallTest.hap", + "ActsSystemAppCalleeARelyHap.hap", + "ActsThirdAppARelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/FifthAbility/FifthAbility.ts b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/FifthAbility/FifthAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..66fbe5dde7b3cafe046ce7d96c1e9c2f41336d36 --- /dev/null +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/FifthAbility/FifthAbility.ts @@ -0,0 +1,124 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest FifthAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA FifthAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest FifthAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class FifthAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemCallTest FifthAbility onCreate") + globalThis.abilityWant = want; + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemCallTest FifthAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemCallTest FifthAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/second/second", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemCallTest FifthAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemCallTest FifthAbility onForeground") + if ((globalThis.abilityWant.parameters.case_num == "case1300") || + (globalThis.abilityWant.parameters.case_num == "case1400")) { + var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; + var commonEventData = { + data: publishData, + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>SystemAppCallerA FifthAbility Call_Finish<======') + }) + } + } + + onBackground() { + // Ability has back to background + console.log("SystemCallTest FifthAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/ForthAbility/ForthAbility.ts b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/ForthAbility/ForthAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d59601cafa3b7889f6ba1af8c0db7d43fbbec96b --- /dev/null +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/ForthAbility/ForthAbility.ts @@ -0,0 +1,124 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest ForthAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA ForthAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest ForthAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class ForthAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemCallTest ForthAbility onCreate") + globalThis.abilityWant = want; + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemCallTest ForthAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemCallTest ForthAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/second/second", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemCallTest ForthAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemCallTest ForthAbility onForeground") + if ((globalThis.abilityWant.parameters.case_num == "case1300") || + (globalThis.abilityWant.parameters.case_num == "case1400")) { + var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; + var commonEventData = { + data: publishData, + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>SystemAppCallerA ForthAbility Call_Finish<======') + }) + } + } + + onBackground() { + // Ability has back to background + console.log("SystemCallTest ForthAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..062dcef198fd612a4f587811862fc973f7fc9a89 --- /dev/null +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,124 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA SecondAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest SecondAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemCallTest SecondAbility onCreate") + globalThis.abilityWant = want; + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemCallTest SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemCallTest SecondAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/second/second", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemCallTest SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemCallTest SecondAbility onForeground") + if ((globalThis.abilityWant.parameters.case_num == "case1300") || + (globalThis.abilityWant.parameters.case_num == "case1400")) { + var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; + var commonEventData = { + data: publishData, + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>SystemAppCallerA SecondAbility Call_Finish<======') + }) + } + } + + onBackground() { + // Ability has back to background + console.log("SystemCallTest SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/ThirdAbility/ThirdAbility.ts b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/ThirdAbility/ThirdAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9aa3312ee6f29669a8501b155aff2fac1259768c --- /dev/null +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/ThirdAbility/ThirdAbility.ts @@ -0,0 +1,124 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +class MySequenceable { + num: number = 0; + str: String = ""; + result: String = ""; + + constructor(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + setMySequence(num, string, result) { + this.num = num; + this.str = string; + this.result = result; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + messageParcel.writeString(this.result); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + this.result = messageParcel.readString(); + return true; + } +} + +function testCall(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest ThirdAbility on testCall <======') + data.readSequenceable(recvSequence); + var result = recvSequence.str + 'processed'; + var commonEventData = { + code: 0, + data: 'calleeCheckCallParam', + parameters: { + num: recvSequence.num, + str: recvSequence.str, + result: result + } + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>CallTestSysA ThirdAbility Call_Finish<======') + }) + return recvSequence; +} + +function testCallWithResult(data) { + let recvSequence = new MySequenceable(0, '', ''); + console.log('======>SystemCallTest ThirdAbility on testCall <======') + data.readSequenceable(recvSequence); + let result = recvSequence.str + 'processed'; + recvSequence.setMySequence(recvSequence.num, recvSequence.str, result); + + return recvSequence; +} + +export default class ThirdAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SystemCallTest ThirdAbility onCreate") + globalThis.abilityWant = want; + this.callee.on('testCall', testCall); + this.callee.on('testCallWithResult', testCallWithResult); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SystemCallTest ThirdAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SystemCallTest ThirdAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/second/second", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SystemCallTest ThirdAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SystemCallTest ThirdAbility onForeground") + if ((globalThis.abilityWant.parameters.case_num == "case1300") || + (globalThis.abilityWant.parameters.case_num == "case1400")) { + var publishData = globalThis.abilityWant.parameters.case_num + "targetForeground"; + var commonEventData = { + data: publishData, + } + commonEvent.publish('CallTest', commonEventData, (err) => { + console.log('======>SystemAppCallerA ThirdAbility Call_Finish<======') + }) + } + } + + onBackground() { + // Ability has back to background + console.log("SystemCallTest ThirdAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7de8d97bf41542a2e9722f2953ad5739feffbd0e --- /dev/null +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 10000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/module.json b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/module.json rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actscalltest/thirdcalltest/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/thirdcalltest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actscalltest/thirdcalltest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actscalltest/thirdcalltest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/BUILD.gn b/ability/ability_runtime/actsfwkdataaccessortest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/BUILD.gn rename to ability/ability_runtime/actsfwkdataaccessortest/BUILD.gn diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/AbilityStage.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/AbilityStage.ts rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7b0c3975269419cbd995732561411bf502e6a1b --- /dev/null +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts @@ -0,0 +1,254 @@ +/* + * 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 dataAbility from '@ohos.data.dataAbility' +import featureAbility from '@ohos.ability.featureAbility' +import fileio from '@ohos.fileio' +import dataRdb from '@ohos.data.rdb' + +const TABLE_NAME = 'book' +const STORE_CONFIG = {name: 'book.db'} +const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book' + + '(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER, introduction TEXT NOT NULL)' +let rdbStore: any = undefined +const TAG = 'ACTS_ DataAbility.data' +const context = featureAbility.getContext() + +let defaultReturn = 1; +let returnError = 0; +let returnError1 = -1; +let returnError2 = -2; +let returnError3 = -3; +let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility"); + +export default { + + onInitialized(abilityInfo) { + console.debug('ACTS_ DataAbility onInitialized,abilityInfo=' + abilityInfo.bundleName) + dataRdb.getRdbStore(context, STORE_CONFIG, 1, (err, store) => { + console.debug('ACTS_ [data]getRdbStoreThen') + store.executeSql(SQL_CREATE_TABLE, []) + rdbStore = store + }); + }, + + insert(uri, valueBucket, callback) { + console.debug(TAG + ' insert start 1121') + console.debug(TAG + ' valueBucket json=>' + JSON.stringify(valueBucket)) + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) + console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) + console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) + if (valueBucket.age != 24) { + err = "Error age" + callback(err, returnError2); + } + if (valueBucket.name != "ActsDataAbilityHelperTest") { + err = "Error name" + callback(err, returnError2); + } + if (valueBucket.salary != 2024.20) { + err = "Error salary" + callback(err, returnError2); + } + + err = "Error insert" + console.debug(TAG + ' rdbStore.insert ') + rdbStore.insert(TABLE_NAME, valueBucket, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + + query(uri, columns, predicates, callback) { + console.debug(TAG + ' query start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.query(rdbPredicates, columns, callback) + }, + + update(uri, valueBucket, predicates, callback) { + console.debug(TAG + 'update start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) + console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) + console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) + if (valueBucket.age != 24) { + err = "Error age" + callback(err, returnError2); + } + if (valueBucket.name != "ActsDataAbilityHelperTest") { + err = "Error name" + callback(err, returnError2); + } + if (valueBucket.salary != 2024.20) { + err = "Error salary" + callback(err, returnError2); + } + + err = "Error update" + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.update(valueBucket, rdbPredicates, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + + delete(uri, predicates, callback) { + console.debug(TAG + 'delete start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.delete(rdbPredicates, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + call(uri, method, arg, extras, callback) { + console.debug(TAG + 'call start') + console.debug(TAG + 'uri---->' + uri) + console.debug(TAG + 'method---->' + uri) + }, + + batchInsert(uri, values, callback) { + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + for (var j = 0; j < values.length; j++) { + rdbStore.insert("EMPLOYEE", values[j], function (err, ret) { + console.log(TAG + "batchInsert callback ret:" + JSON.stringify(ret)) + }) + } + console.log(TAG + "batchInsert values.length:" + values.length + ' ,json=' + JSON.stringify(values.length)) + callback(err, values.length); + }, + + getType(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by getType ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + callback("success", uri); + }, + + getFileTypes(uri, mimeTypeFilter, callback) { + console.info(TAG + '==================== DataAbility test interface by GetFileTypes ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + let type1 = " "; + let type2 = " "; + let type3 = " "; + let types; + if (mimeTypeFilter == "*/*") { + type1 = ("hap"); + type2 = ("jpg"); + type3 = ("image/png"); + types = [type1, type2, type3]; + } else if (mimeTypeFilter == "image/*") { + type1 = ("image/png"); + types = [type1]; + } else if (mimeTypeFilter == "*/jpg") { + type1 = ("jpg"); + types = [type1]; + } + + console.log(TAG + "GetFileTypes callback ret:" + JSON.stringify(types)) + callback("success", types); + }, + + openFile(uri, mode, callback) { + console.info(TAG + '==================== DataAbility test interface by openFile ================'); + let defaultReturn = 1; + let returnError1 = -1; + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + if (!(mode == ("r") || mode == ("w") || mode == ("wt") || mode == ("wa") || + mode == ("rw") || mode == ("rwt"))) { + if (mode == ("A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7")) { + defaultReturn = returnError2; + } else + defaultReturn = returnError3; + } + console.info(TAG + " path = /data/test "); + let path = "/data/test" + fileio.stat(path).then(function (stat) { + console.info(TAG + "openFile getFileInfo successfully callback ret:" + JSON.stringify(stat)); + }).catch(function (err) { + console.info(TAG + "openFile getFileInfo failed with error callback ret:" + err); + defaultReturn = returnError1; + }); + console.info(TAG + " path ==>" + path); + callback("success", defaultReturn); + }, + + normalizeUri(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by normalizeUri ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, ""); + } + callback("success", uri); + }, + + denormalizeUri(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by denormalizeUri ================'); + console.info(TAG + "denormalizeUri uri:" + JSON.stringify(uri)); + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, ""); + } + callback("success", uri); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd2464a1f5bad522f0e129fd654c9e92927baa36 --- /dev/null +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts @@ -0,0 +1,254 @@ +/* + * 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 dataAbility from '@ohos.data.dataAbility' +import featureAbility from '@ohos.ability.featureAbility' +import fileio from '@ohos.fileio' +import dataRdb from '@ohos.data.rdb' + +const TABLE_NAME = 'book' +const STORE_CONFIG = {name: 'book.db'} +const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book' + + '(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER, introduction TEXT NOT NULL)' +let rdbStore: any = undefined +const TAG = 'ACTS_ DataAbility.data' +const context = featureAbility.getContext() + +let defaultReturn = 1; +let returnError = 0; +let returnError1 = -1; +let returnError2 = -2; +let returnError3 = -3; +let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility2"); + +export default { + + onInitialized(abilityInfo) { + console.debug('ACTS_ DataAbility onInitialized,abilityInfo=' + abilityInfo.bundleName) + dataRdb.getRdbStore(context, STORE_CONFIG, 1, (err, store) => { + console.debug('ACTS_ [data]getRdbStoreThen') + store.executeSql(SQL_CREATE_TABLE, []) + rdbStore = store + }); + }, + + insert(uri, valueBucket, callback) { + console.debug(TAG + ' insert start 1121') + console.debug(TAG + ' valueBucket json=>' + JSON.stringify(valueBucket)) + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) + console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) + console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) + if (valueBucket.age != 24) { + err = "Error age" + callback(err, returnError2); + } + if (valueBucket.name != "ActsDataAbilityHelperTest") { + err = "Error name" + callback(err, returnError2); + } + if (valueBucket.salary != 2024.20) { + err = "Error salary" + callback(err, returnError2); + } + + err = "Error insert" + console.debug(TAG + ' rdbStore.insert ') + rdbStore.insert(TABLE_NAME, valueBucket, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + + query(uri, columns, predicates, callback) { + console.debug(TAG + ' query start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.query(rdbPredicates, columns, callback) + }, + + update(uri, valueBucket, predicates, callback) { + console.debug(TAG + 'update start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) + console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) + console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) + if (valueBucket.age != 24) { + err = "Error age" + callback(err, returnError2); + } + if (valueBucket.name != "ActsDataAbilityHelperTest") { + err = "Error name" + callback(err, returnError2); + } + if (valueBucket.salary != 2024.20) { + err = "Error salary" + callback(err, returnError2); + } + + err = "Error update" + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.update(valueBucket, rdbPredicates, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + + delete(uri, predicates, callback) { + console.debug(TAG + 'delete start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.delete(rdbPredicates, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + call(uri, method, arg, extras, callback) { + console.debug(TAG + 'call start') + console.debug(TAG + 'uri---->' + uri) + console.debug(TAG + 'method---->' + uri) + }, + + batchInsert(uri, values, callback) { + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + for (var j = 0; j < values.length; j++) { + rdbStore.insert("EMPLOYEE", values[j], function (err, ret) { + console.log(TAG + "batchInsert callback ret:" + JSON.stringify(ret)) + }) + } + console.log(TAG + "batchInsert values.length:" + values.length + ' ,json=' + JSON.stringify(values.length)) + callback(err, values.length); + }, + + getType(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by getType ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + callback("success", uri); + }, + + getFileTypes(uri, mimeTypeFilter, callback) { + console.info(TAG + '==================== DataAbility test interface by GetFileTypes ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + let type1 = " "; + let type2 = " "; + let type3 = " "; + let types; + if (mimeTypeFilter == "*/*") { + type1 = ("hap"); + type2 = ("jpg"); + type3 = ("image/png"); + types = [type1, type2, type3]; + } else if (mimeTypeFilter == "image/*") { + type1 = ("image/png"); + types = [type1]; + } else if (mimeTypeFilter == "*/jpg") { + type1 = ("jpg"); + types = [type1]; + } + + console.log(TAG + "GetFileTypes callback ret:" + JSON.stringify(types)) + callback("success", types); + }, + + openFile(uri, mode, callback) { + console.info(TAG + '==================== DataAbility test interface by openFile ================'); + let defaultReturn = 1; + let returnError1 = -1; + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + if (!(mode == ("r") || mode == ("w") || mode == ("wt") || mode == ("wa") || + mode == ("rw") || mode == ("rwt"))) { + if (mode == ("A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7")) { + defaultReturn = returnError2; + } else + defaultReturn = returnError3; + } + console.info(TAG + " path = /data/test "); + let path = "/data/test" + fileio.stat(path).then(function (stat) { + console.info(TAG + "openFile getFileInfo successfully callback ret:" + JSON.stringify(stat)); + }).catch(function (err) { + console.info(TAG + "openFile getFileInfo failed with error callback ret:" + err); + defaultReturn = returnError1; + }); + console.info(TAG + " path ==>" + path); + callback("success", defaultReturn); + }, + + normalizeUri(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by normalizeUri ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, ""); + } + callback("success", uri); + }, + + denormalizeUri(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by denormalizeUri ================'); + console.info(TAG + "denormalizeUri uri:" + JSON.stringify(uri)); + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, ""); + } + callback("success", uri); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/Test.json b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/Test.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/Test.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/Test.json diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/config.json b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/config.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/app.js b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/app.js rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a0c94f156a0a475468797244a41c63748c040d15 --- /dev/null +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js @@ -0,0 +1,8524 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import ohosDataAbility from '@ohos.data.dataability' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsDataAbilityHelperTest', function () { + let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility"); + let dataAbilityUri2 = ("dataability:///com.example.myapplication.DataAbility2"); + let dataAbilityUri3 = ("dataability:///com.example.myapplication.DataAbility3"); + let DAHelper; + let gSetTimeout = 500; + var valueBucket = { + "name": "ActsDataAbilityHelperTest", + "age": 24, + "salary": 2024.20, + } + + beforeAll(async (done) => { + console.debug('= ACTS_beforeAll ====: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); + if(DAHelper == null){ + console.debug('ACTS_beforeAll DAHelper ====>: DAHelper == null'); + } + } catch (err) { + console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); + } + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ====" + dataAbilityUri) + try { + var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) + console.log('ACTS_AcquireDataAbilityHelper_0100 abilityHelper ====>: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + if(DAHelper == null){ + DAHelper = abilityHelper; + } + expect(typeof (abilityHelper)).assertEqual("object"); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + done(); + console.log('ACTS_AcquireDataAbilityHelper_0100====: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + expect(abilityHelper).assertEqual(null); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0200 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + done(); + console.log('ACTS_AcquireDataAbilityHelper_0200====: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + expect(abilityHelper).assertEqual(null); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0300 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + done(); + console.log('ACTS_AcquireDataAbilityHelper_0300====: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + expect(JSON.stringify(abilityHelper)).assertEqual("null"); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0400 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + done(); + console.log('ACTS_AcquireDataAbilityHelper_0400====: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + expect(JSON.stringify(abilityHelper)).assertEqual("null"); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0500 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + done(); + console.log('ACTS_AcquireDataAbilityHelper_0500====: ' + DAHelper) + let valueBucketM + try { + DAHelper.insert(dataAbilityUri, valueBucketM) + .then(function (data) { + console.debug("=ACTS_Insert_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-2); + console.log('ACTS_Insert_0100====" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Insert_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Insert_0100====: ' + DAHelper) + let valueBucketM = 'undefined'; + try { + await DAHelper.insert(dataAbilityUri, valueBucketM, + (err, data) => { + console.debug("=ACTS_Insert_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】data【") + data + (" 】;")); + expect(data).assertEqual(-2); + console.log('ACTS_Insert_0200====:' + err); + console.log('ACTS_Insert_0200==== { + console.debug("=ACTS_Insert_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + console.log('ACTS_Insert_0300==== { + console.debug("=ACTS_Insert_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_0300====:' + err); + console.log('ACTS_Insert_0300====: ' + DAHelper) + try { + await DAHelper.insert(dataAbilityUri, valueBucket, + (err, data) => { + console.debug("=ACTS_Insert_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + console.log('ACTS_Insert_0400====:' + err); + console.log('ACTS_Insert_0400==== { + console.debug("=ACTS_Insert_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_Insert_0500==== { + console.debug("=ACTS_Insert_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_0500====:' + err); + console.log('ACTS_Insert_0500====: ' + DAHelper) + try { + await DAHelper.insert(undefined, valueBucket, + (err, data) => { + console.debug("=ACTS_Insert_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + expect(data).assertEqual(0); + console.log('ACTS_Insert_0600====:' + err); + console.log('ACTS_Insert_0600==== { + console.debug("=ACTS_Insert_0700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_Insert_0700==== { + console.debug("=ACTS_Insert_0700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_0700====:' + err); + console.log('ACTS_Insert_0700====: ' + DAHelper) + var currentAlertTimeout; + try { + function onAsyncCallbackInsert0800(err) { + clearTimeout(currentAlertTimeout); + expect(err.code).assertEqual(0); + console.log('ACTS_Insert_0800==== { + console.debug("=ACTS_Insert_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_Insert_0800====:' + err); + console.log('ACTS_Insert_0800==== { + console.debug("=ACTS_Insert_0900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_Insert_0900==== { + console.debug("=ACTS_Insert_0900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_0900====:' + err); + console.log('ACTS_Insert_0900====: ' + DAHelper) + try { + await DAHelper.insert(123456, valueBucket, + (err, data) => { + console.debug("=ACTS_Insert_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + expect(data).assertEqual(0); + console.log('ACTS_Insert_1000====:' + err); + console.log('ACTS_Insert_1000==== { + console.debug("=ACTS_Insert_1100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_Insert_1100==== { + console.debug("=ACTS_Insert_1100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_1100====:' + err); + console.log('ACTS_Insert_1100====: ' + DAHelper) + try { + await DAHelper.insert(dataAbilityUri2, valueBucket, + (err, data) => { + console.debug("=ACTS_Insert_1200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_Insert_1200====:' + err); + console.log('ACTS_Insert_1200==== { + console.debug("=ACTS_Insert_1300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_Insert_1300==== { + console.debug("=ACTS_Insert_1300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_1300====:' + err); + console.log('ACTS_Insert_1300====: ' + DAHelper) + try { + await DAHelper.insert("errorUri", valueBucket, + (err, data) => { + console.debug("=ACTS_Insert_1400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_Insert_1400====:' + err); + console.log('ACTS_Insert_1400==== { + console.debug("=ACTS_Insert_1500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-2); + console.log('ACTS_Insert_1500==== { + console.debug("=ACTS_Insert_1500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Insert_1500====:' + err); + console.log('ACTS_Insert_1500====: ' + DAHelper) + var valueBucketK = {}; + try { + await DAHelper.insert(dataAbilityUri, valueBucketK, + (err, data) => { + console.debug("=ACTS_Insert_1600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-2); + console.log('ACTS_Insert_1600====:' + err); + console.log('ACTS_Insert_1600====: ' + DAHelper) + var valueBucketM; + try { + DAHelper.batchInsert( + dataAbilityUri, + valueBucketM + ).then((data) => { + console.debug("=ACTS_BatchInsert_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); + expect(data).assertEqual(0); + console.log('ACTS_BatchInsert_0100==== { + console.debug("=ACTS_BatchInsert_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_0100====:' + err); + console.log('ACTS_BatchInsert_0100====: ' + DAHelper) + var valueBucketM; + try { + await DAHelper.batchInsert( + dataAbilityUri, + valueBucketM, + (err, data) => { + console.debug("=ACTS_BatchInsert_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(0); + console.log('ACTS_BatchInsert_0200====:' + err); + console.log('ACTS_BatchInsert_0200====: ' + DAHelper) + var valueBucketArray = new Array({}, {}, {}) + try { + DAHelper.batchInsert( + dataAbilityUri, + valueBucketArray, + ).then((data) => { + console.debug("=ACTS_BatchInsert_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); + expect(data).assertEqual(3); + console.log('ACTS_BatchInsert_0300==== { + console.debug("=ACTS_BatchInsert_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_0300====:' + err); + console.log('ACTS_BatchInsert_0300====: ' + DAHelper) + var valueBucketArray = new Array({}, {}, {}) + try { + await DAHelper.batchInsert( + dataAbilityUri, + valueBucketArray, + (err, data) => { + console.debug("=ACTS_BatchInsert_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(3); + console.log('ACTS_BatchInsert_0400====:' + err); + console.log('ACTS_BatchInsert_0400====: ' + DAHelper) + try { + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + + DAHelper.batchInsert( + dataAbilityUri, + valueBucketArray, + ).then((data) => { + console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(3); + console.log('ACTS_BatchInsert_0500==== { + console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_0500====:' + err); + console.log('ACTS_BatchInsert_0500====: ' + DAHelper) + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + try { + await DAHelper.batchInsert( + dataAbilityUri, + valueBucketArray, + (err, data) => { + console.debug("=ACTS_BatchInsert_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(3); + console.log('ACTS_BatchInsert_0600====:' + err); + console.log('ACTS_BatchInsert_0600====: ' + DAHelper) + try { + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + + DAHelper.batchInsert( + dataAbilityUri2, + valueBucketArray, + ).then((data) => { + console.debug("=ACTS_BatchInsert_0700 BatchInsert Promise then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_BatchInsert_0700==== { + console.debug("=ACTS_BatchInsert_0700 BatchInsert Promise catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_0700====:' + err); + console.log('ACTS_BatchInsert_0700====: ' + DAHelper) + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + try { + await DAHelper.batchInsert( + dataAbilityUri2, + valueBucketArray, + (err, data) => { + console.debug("=ACTS_BatchInsert_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_BatchInsert_0800====:' + err); + console.log('ACTS_BatchInsert_0800====: ' + DAHelper) + try { + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + + DAHelper.batchInsert( + undefined, + valueBucketArray, + ).then((data) => { + console.debug("=ACTS_BatchInsert_0900 BatchInsert Promise then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_BatchInsert_0900==== { + console.debug("=ACTS_BatchInsert_0900 BatchInsert Promise catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_0900====:' + err); + console.log('ACTS_BatchInsert_0900====: ' + DAHelper) + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + try { + await DAHelper.batchInsert( + undefined, + valueBucketArray, + (err, data) => { + console.debug("=ACTS_BatchInsert_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + console.log('ACTS_BatchInsert_1000====:' + err); + console.log('ACTS_BatchInsert_1000====: ' + DAHelper) + try { + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + + DAHelper.batchInsert( + "error", + valueBucketArray, + ).then((data) => { + console.debug("=ACTS_BatchInsert_1100 BatchInsert Promise then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_BatchInsert_1100==== { + console.debug("=ACTS_BatchInsert_1100 BatchInsert Promise catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_1100====:' + err); + console.log('ACTS_BatchInsert_1100====: ' + DAHelper) + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + try { + await DAHelper.batchInsert( + "error", + valueBucketArray, + (err, data) => { + console.debug("=ACTS_BatchInsert_1200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_BatchInsert_1200====:' + err); + console.log('ACTS_BatchInsert_1200====: ' + DAHelper) + try { + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + + DAHelper.batchInsert( + 123456, + valueBucketArray, + ).then((data) => { + console.debug("=ACTS_BatchInsert_1300 BatchInsert Promise then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_BatchInsert_1300==== { + console.debug("=ACTS_BatchInsert_1300 BatchInsert Promise catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_1300====:' + err); + console.log('ACTS_BatchInsert_1300====: ' + DAHelper) + var valueBucketArray = new Array({ "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }, + { "name": "ActsDataAbilityHelperTest", "age": 24, "salary": 2024.20, }) + try { + await DAHelper.batchInsert( + 123456, + valueBucketArray, + (err, data) => { + console.debug("=ACTS_BatchInsert_1400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + console.log('ACTS_BatchInsert_1400====:' + err); + console.log('ACTS_BatchInsert_1400====: ' + DAHelper) + try { + DAHelper.batchInsert( + dataAbilityUri, + valueBucket, + ).then((data) => { + console.debug("=ACTS_BatchInsert_1500 BatchInsert Promise then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_BatchInsert_1500==== { + console.debug("=ACTS_BatchInsert_1500 BatchInsert Promise catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_1500====:' + err); + console.log('ACTS_BatchInsert_1500====: ' + DAHelper) + try { + await DAHelper.batchInsert( + dataAbilityUri, + valueBucket, + (err, data) => { + console.debug("=ACTS_BatchInsert_1600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(0); + console.log('ACTS_BatchInsert_1600====:' + err); + console.log('ACTS_BatchInsert_1600====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_0100====:' + err); + console.log('ACTS_Query_0100==== { + console.debug("=ACTS_Query_0200 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_0200====:' + err); + console.log('ACTS_Query_0200====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_0300====:' + err); + console.log('ACTS_Query_0300==== { + console.debug("=ACTS_Query_0400 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_0400====:' + err); + console.log('ACTS_Query_0400====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_0500====:' + err); + console.log('ACTS_Query_0500==== { + console.debug("=ACTS_Query_0600 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_0600====:' + err); + console.log('ACTS_Query_0600====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_0700====:' + err); + console.log('ACTS_Query_0700==== { + console.debug("=ACTS_Query_0800 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_0800====:' + err); + console.log('ACTS_Query_0800====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_0900====:' + err); + console.log('ACTS_Query_0900==== { + console.debug("=ACTS_Query_1000 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_1000====:' + err); + console.log('ACTS_Query_1000====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_1100====:' + err); + console.log('ACTS_Query_1100==== { + console.debug("=ACTS_Query_1200 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_1200====:' + err); + console.log('ACTS_Query_1200====" + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + console.log('ACTS_Query_1300====:' + err); + console.log('ACTS_Query_1300==== { + console.debug("=ACTS_Query_1400 query err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); + console.log('ACTS_Query_1400====:' + err); + console.log('ACTS_Query_1400====: ' + DAHelper) + try { + let valueBucketNull = {}; + let predicates = new ohosDataAbility.DataAbilityPredicates(); + console.debug("=ACTS_Update_0100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + dataAbilityUri, + valueBucketNull, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-2); + console.log('ACTS_Update_0100==== { + console.debug("=ACTS_Update_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Update_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Update_0100====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + dataAbilityUri, + valueBucketNull, + predicates, + (err, data) => { + console.debug("=ACTS_Update_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-2); + console.log('ACTS_Update_0200====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Update_0200====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0300 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + dataAbilityUri, + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + console.log('ACTS_Update_0300==== { + console.debug("=ACTS_Update_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Update_0300====:' + err); + console.log('ACTS_Update_0300====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0400 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + dataAbilityUri, + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + console.log('ACTS_Update_0400====:' + err); + console.log('ACTS_Update_0400====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0500 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + undefined, + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_Update_0500==== { + console.debug("=ACTS_Update_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Update_0500====:' + err); + console.log('ACTS_Update_0500====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0600 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + undefined, + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + expect(data).assertEqual(0); + console.log('ACTS_Update_0600====:' + err); + console.log('ACTS_Update_0600====: ' + DAHelper) + var currentAlertTimeout; + try { + function onAsyncCallbackUpdate0700(err) { + expect(err.code).assertEqual(0); + clearTimeout(currentAlertTimeout); + console.log('ACTS_Update_0700====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + dataAbilityUri, + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_Update_0700==== { + console.debug("=ACTS_Update_0700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + err); + console.log('ACTS_Update_0700====:' + err); + console.log('ACTS_Update_0700====: ' + DAHelper) + var currentAlertTimeout; + try { + function onAsyncCallbackUpdate0800(err) { + expect(err.code).assertEqual(0); + clearTimeout(currentAlertTimeout); + console.log('ACTS_Update_0800====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + dataAbilityUri, + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_Update_0800====:' + err); + console.log('ACTS_Update_0800====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0900 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + 123456, + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_Update_0900==== { + console.debug("=ACTS_Update_0900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Update_0900====:' + err); + console.log('ACTS_Update_0900====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_1000 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + 123456, + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + expect(data).assertEqual(0); + console.log('ACTS_Update_1000====:' + err); + console.log('ACTS_Update_1000====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_1100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + dataAbilityUri2, + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_1100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_Update_1100==== { + console.debug("=ACTS_Update_1100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Update_1100====:' + err); + console.log('ACTS_Update_1100====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_1200 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + dataAbilityUri2, + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_1200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_Update_1200====:' + err); + console.log('ACTS_Update_1200====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_1300 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + "error_uri", + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_1300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_Update_1300==== { + console.debug("=ACTS_Update_1300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Update_1300====:' + err); + console.log('ACTS_Update_1300====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_1400 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( + "error_uri", + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_1400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_Update_1400====:' + err); + console.log('ACTS_Update_1400====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + console.debug("=ACTS_Delete_0100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + dataAbilityUri, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + console.log('ACTS_Delete_0100==== { + console.debug("=ACTS_Delete_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Delete_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0100====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + console.debug("=ACTS_Delete_0200 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + dataAbilityUri, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + console.log('ACTS_Delete_0200====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0200====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + dataAbilityUri, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + console.log('ACTS_Delete_0300==== { + console.debug("=ACTS_Delete_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Delete_0300====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0300====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Delete_0400 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + dataAbilityUri, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + console.log('ACTS_Delete_0400====:' + err); + console.log('ACTS_Delete_0400====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + undefined, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_Delete_0500==== { + console.debug("=ACTS_Delete_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Delete_0500====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0500====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Delete_0600 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + undefined, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + expect(data).assertEqual(0); + console.log('ACTS_Delete_0600====:' + err); + console.log('ACTS_Delete_0600====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + dataAbilityUri, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_Delete_0700==== { + console.debug("=ACTS_Delete_0700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Delete_0700====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0700====: ' + DAHelper) + var currentAlertTimeout; + try { + function onAsyncCallbackDelete0800(err) { + expect(err.code).assertEqual(0); + clearTimeout(currentAlertTimeout); + console.log('ACTS_Delete_0800====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + dataAbilityUri, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_Delete_0800====:' + err); + console.log('ACTS_Delete_0800====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + dataAbilityUri2, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_Delete_0900==== { + console.debug("=ACTS_Delete_0900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Delete_0900====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0900====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Delete_1000 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + dataAbilityUri2, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_Delete_1000====:' + err); + console.log('ACTS_Delete_1000====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + "error", + predicates + ).then((data) => { + console.debug("=ACTS_Delete_1100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1); + console.log('ACTS_Delete_1100==== { + console.debug("=ACTS_Delete_1100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Delete_1100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_1100====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Delete_1200 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + "error", + predicates, + (err, data) => { + console.debug("=ACTS_Delete_1200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_Delete_1200====:' + err); + console.log('ACTS_Delete_1200====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + 123456, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_1300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0); + console.log('ACTS_Delete_1300==== { + console.debug("=ACTS_Delete_1300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Delete_1300====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_1300====: ' + DAHelper) + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Delete_1400 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + 123456, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_1400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + console.log('ACTS_Delete_1400====:' + err); + console.log('ACTS_Delete_1400==== { + console.debug("=ACTS_GetFileTypes_0100 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(3); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0100 for data[' + i + '] ====>: ' + data[i]) + if (i == 0) { + expect(data[i]).assertEqual("hap"); + } else if (i == 1) { + expect(data[i]).assertEqual("jpg"); + } else if (i == 2) { + expect(data[i]).assertEqual("image/png"); + } + } + console.log('ACTS_GetFileTypes_0100==== { + console.debug("=ACTS_GetFileTypes_0100 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_0100====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0100 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_0100====: ' + DAHelper) + let mimeTypeFilter = '*/*' + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_0200 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_0200 data.length ====>: ' + data.length); + expect(data.length).assertEqual(3); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0200 for data ====>: ' + err.code + + " data[" + i + "]: " + data[i]); + if (i == 0) { + expect(data[i]).assertEqual("hap"); + } else if (i == 1) { + expect(data[i]).assertEqual("jpg"); + } else if (i == 2) { + expect(data[i]).assertEqual("image/png"); + } + } + console.log('ACTS_GetFileTypes_0200====:' + err); + console.log('ACTS_GetFileTypes_0200==== { + console.debug("=ACTS_GetFileTypes_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(1); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('= =ACTS_GetFileTypes_0300 for data[' + i + '] ====>: ' + data[i]) + if (i == 0) { + expect(data[i]).assertEqual("image/png"); + } + } + console.log('ACTS_GetFileTypes_0300==== { + console.debug("=ACTS_GetFileTypes_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('DataAbilityHelper getFileTypes error ====>: ' + err) + console.log('ACTS_GetFileTypes_0300====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0300 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_0300====: ' + DAHelper) + let mimeTypeFilter = 'image/*' + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(1); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0400 for ====>: ' + + err.code + " data[" + i + "]: " + data[i]); + if (i == 0) { + expect(data[i]).assertEqual("image/png"); + } + } + console.log('ACTS_GetFileTypes_0400====:' + err); + console.log('ACTS_GetFileTypes_0400==== { + console.debug("=ACTS_GetFileTypes_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(1); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0500 for data [' + i + '] ====>: ' + data[i]) + if (i == 0) { + expect(data[i]).assertEqual("jpg"); + } + } + console.log('ACTS_GetFileTypes_0500==== { + console.debug("=ACTS_GetFileTypes_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('DataAbilityHelper getFileTypes error ====>: ' + err) + console.log('ACTS_GetFileTypes_0500====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0500 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_0500====: ' + DAHelper) + let mimeTypeFilter = '*/jpg' + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_0600 data.length ====>: ' + data.length); + expect(data.length).assertEqual(1); + for (var i = 0; i < data.length; i++) { + console.log('=ACTS_GetFileTypes_0600 for errCode ====>: ' + err.code + + " data[" + i + "]: " + data[i]); + if (i == 0) + expect(data[i]).assertEqual("jpg"); + } + console.log('ACTS_GetFileTypes_0600====:' + err); + console.log('ACTS_GetFileTypes_0600==== { + console.debug("=ACTS_GetFileTypes_0700 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_0700==== { + console.debug("=ACTS_GetFileTypes_0700 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_0700====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0700 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_0700====: ' + DAHelper) + let mimeTypeFilter = '*/*' + try { + await DAHelper.getFileTypes( + undefined, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_0800 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_0800 data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_0800====:' + err); + console.log('ACTS_GetFileTypes_0800==== { + console.debug("=ACTS_GetFileTypes_0900 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0900 for data[' + i + '] ====>: ' + data[i]) + if (i == 0) { + expect(data[i]).assertEqual(""); + } + } + console.log('ACTS_GetFileTypes_0900==== { + console.debug("=ACTS_GetFileTypes_0900 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_0900====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0900 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_0900====: ' + DAHelper) + try { + await DAHelper.getFileTypes( + dataAbilityUri, + undefined, + (err, data) => { + console.debug("=ACTS_GetFileTypes_1000 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_1000 data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_1000 for data ====>: ' + err.code + + " data[" + i + "]: " + data[i]); + if (i == 0) { + expect(data[i]).assertEqual(""); + } + } + console.log('ACTS_GetFileTypes_1000====:' + err); + console.log('ACTS_GetFileTypes_1000==== { + console.debug("=ACTS_GetFileTypes_1100 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1100==== { + console.debug("=ACTS_GetFileTypes_1100 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_1100====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_1100 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_1100====: ' + DAHelper) + let mimeTypeFilter = '*/*' + try { + await DAHelper.getFileTypes( + "error_uri", + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_1200 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_1200 data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1200====:' + err); + console.log('ACTS_GetFileTypes_1200==== { + console.debug("=ACTS_GetFileTypes_1300 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1300==== { + console.debug("=ACTS_GetFileTypes_1300 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_1300====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_1300 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_1300====: ' + DAHelper) + let mimeTypeFilter = '*/*' + try { + await DAHelper.getFileTypes( + 123456, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_1400 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_1400 data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1400====:' + err); + console.log('ACTS_GetFileTypes_1400==== { + console.debug("=ACTS_GetFileTypes_1500 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1500==== { + console.debug("=ACTS_GetFileTypes_1500 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_1500====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_1500 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_1500====: ' + DAHelper) + let mimeTypeFilter = 'asdfasdEDF)(#@*7fasdf546546a1ds3v16a4sd6v54@*(e7'; + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_1600 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_1600 data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1600====:' + err); + console.log('ACTS_GetFileTypes_1600==== { + console.debug("=ACTS_GetFileTypes_1700 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1700==== { + console.debug("=ACTS_GetFileTypes_1700 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetFileTypes_1700====: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_1700 getFileTypes AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetFileTypes_1700====: ' + DAHelper) + let mimeTypeFilter = 'returnUndefined'; + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_1800 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_1800 data.length ====>: ' + data.length); + expect(data.length).assertEqual(0); + console.log('ACTS_GetFileTypes_1800====:' + err); + console.log('ACTS_GetFileTypes_1800==== { + console.debug("=ACTS_GetType_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(dataAbilityUri); + console.log('ACTS_GetType_0100==== { + console.debug("=ACTS_GetType_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetType_0100====: ' + promise) + } catch (err) { + console.error('=ACTS_GetType_0100 getType AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetType_0100====: ' + DAHelper) + try { + await DAHelper.getType( + dataAbilityUri, + (err, data) => { + console.debug("=ACTS_GetType_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(dataAbilityUri); + console.log('ACTS_GetType_0200====:' + err); + console.log('ACTS_GetType_0200==== { + console.debug("=ACTS_GetType_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0300==== { + console.debug("=ACTS_GetType_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetType_0300====: ' + promise) + } catch (err) { + console.error('=ACTS_GetType_0300 getType AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetType_0300====: ' + DAHelper) + try { + await DAHelper.getType( + undefined, + (err, data) => { + console.debug("=ACTS_GetType_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0400====:' + err); + console.log('ACTS_GetType_0400==== { + console.debug("=ACTS_GetType_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0500==== { + console.debug("=ACTS_GetType_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetType_0500====: ' + promise) + } catch (err) { + console.error('=ACTS_GetType_0500 getType AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetType_0500====: ' + DAHelper) + try { + await DAHelper.getType( + 123456, + (err, data) => { + console.debug("=ACTS_GetType_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0600====:' + err); + console.log('ACTS_GetType_0600==== { + console.debug("=ACTS_GetType_0700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0700==== { + console.debug("=ACTS_GetType_0700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetType_0700====: ' + promise) + } catch (err) { + console.error('=ACTS_GetType_0700 getType AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetType_0700====: ' + DAHelper) + try { + await DAHelper.getType( + "error_uri", + (err, data) => { + console.debug("=ACTS_GetType_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0800====:' + err); + console.log('ACTS_GetType_0800==== { + console.debug("=ACTS_GetType_0900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_0900==== { + console.debug("=ACTS_GetType_0900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_GetType_0900====: ' + promise) + } catch (err) { + console.error('=ACTS_GetType_0900 getType AsyncCallback catch(err)====>:' + err); + console.log('ACTS_GetType_0900====: ' + DAHelper) + try { + await DAHelper.getType( + dataAbilityUri3, + (err, data) => { + console.debug("=ACTS_GetType_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_GetType_1000====:' + err); + console.log('ACTS_GetType_1000==== { + console.debug("=ACTS_OpenFile_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0100 getType catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0100==== { + console.debug("=ACTS_OpenFile_0200 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") + console.log('DataAbilityHelper ACTS_OpenFile_0200 OpenFile promise ====>: ' + data) + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0200 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0200 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0200==== { + console.debug("=ACTS_OpenFile_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") + console.log('DataAbilityHelper ACTS_OpenFile_0300 OpenFile promise ====>: ' + data) + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0300 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0300==== { + console.debug("=ACTS_OpenFile_0400 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") + console.log('DataAbilityHelper ACTS_OpenFile_0400 OpenFile promise ====>: ' + data) + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0400 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0400 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0400==== { + console.debug("=ACTS_OpenFile_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") + console.log('DataAbilityHelper ACTS_OpenFile_0500 OpenFile promise ====>: ' + data) + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0500 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0500==== { + console.debug("=ACTS_OpenFile_0600 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") + console.log('DataAbilityHelper ACTS_OpenFile_0600 OpenFile promise ====>: ' + data) + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0600 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0600 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0600====: ' + DAHelper) + var mode = "r"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_0700 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_0700 OpenFile asyncCallback errCode ====>: ' + + err.code + " data: " + data); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_0700 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0700====: ' + DAHelper) + var mode = "w"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_0800 OpenFile asyncCallback errCode ====>: ' + + err.code + " data: " + data); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_0800 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0800====: ' + DAHelper) + var mode = "wt"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_0900 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_0900 OpenFile asyncCallback errCode ====>: ' + + err.code + " data: " + data); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_0900 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_0900====: ' + DAHelper) + var mode = "wa"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_1000 err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_1000 OpenFile asyncCallback errCode ====>: ' + + err.code + " data: " + data); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_1000 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_1000====: ' + DAHelper) + var mode = "rw"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_1100 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_1100 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_1100====: ' + DAHelper) + var mode = "rwt"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_1200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_1200 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_1200==== { + console.debug("=ACTS_OpenFile_1300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(0) + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_1300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_1300 getType catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_1300====: ' + DAHelper) + var mode = "rwt"; + try { + DAHelper.openFile( + undefined, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_1400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_OpenFile_1400 getType AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, gSetTimeout); + console.log('ACTS_OpenFile_1400==== { + console.debug("=ACTS_OpenFile_1500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1) + console.log('ACTS_OpenFile_1500==== { + console.debug("=ACTS_OpenFile_1500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_OpenFile_1500====:' + err); + console.log('ACTS_OpenFile_1500====: ' + DAHelper) + try { + DAHelper.openFile( + dataAbilityUri, + undefined, + (err, data) => { + console.debug("=ACTS_OpenFile_1600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_OpenFile_1600====:' + err); + console.log('ACTS_OpenFile_1600==== { + console.debug("=ACTS_OpenFile_1700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1) + console.log('ACTS_OpenFile_1700==== { + console.debug("=ACTS_OpenFile_1700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_OpenFile_1700====:' + err); + console.log('ACTS_OpenFile_1700====: ' + DAHelper) + var mode = "A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7"; + try { + DAHelper.openFile( + dataAbilityUri, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_1800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_OpenFile_1800====:' + err); + console.log('ACTS_OpenFile_1800==== { + console.debug("=ACTS_OpenFile_1900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(-1) + console.log('ACTS_OpenFile_1900==== { + console.debug("=ACTS_OpenFile_1900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_OpenFile_1900====:' + err); + console.log('ACTS_OpenFile_1900====: ' + DAHelper) + var mode = "rwt"; + try { + DAHelper.openFile( + dataAbilityUri2, + mode, + (err, data) => { + console.debug("=ACTS_OpenFile_2000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(-1); + console.log('ACTS_OpenFile_2000====:' + err); + console.log('ACTS_OpenFile_2000====: ' + DAHelper) + try { + DAHelper.normalizeUri( + dataAbilityUri, + ).then((data) => { + console.debug("=ACTS_NormalizeUri_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(dataAbilityUri); + console.log('ACTS_NormalizeUri_0100==== { + console.debug("=ACTS_NormalizeUri_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_NormalizeUri_0100====:' + err); + console.log('ACTS_NormalizeUri_0100====: ' + DAHelper) + try { + DAHelper.normalizeUri( + dataAbilityUri, + (err, data) => { + console.debug("=ACTS_NormalizeUri_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("string"); + expect(data).assertEqual(dataAbilityUri); + console.log('ACTS_NormalizeUri_0200====:' + err); + console.log('ACTS_NormalizeUri_0200====: ' + DAHelper) + try { + DAHelper.normalizeUri( + undefined, + ).then((data) => { + console.debug("=ACTS_NormalizeUri_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_NormalizeUri_0300==== { + console.debug("=ACTS_NormalizeUri_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_NormalizeUri_0300====:' + err); + console.log('ACTS_NormalizeUri_0300====: ' + DAHelper) + try { + DAHelper.normalizeUri( + undefined, + (err, data) => { + console.debug("=ACTS_NormalizeUri_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + console.log('ACTS_NormalizeUri_0400====:' + err); + console.log('ACTS_NormalizeUri_0400====: ' + DAHelper) + try { + DAHelper.normalizeUri( + 123456, + ).then((data) => { + console.debug("=ACTS_NormalizeUri_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_NormalizeUri_0500==== { + console.debug("=ACTS_NormalizeUri_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_NormalizeUri_0500====:' + err); + console.log('ACTS_NormalizeUri_0500====: ' + DAHelper) + try { + DAHelper.normalizeUri( + 123456, + (err, data) => { + console.debug("=ACTS_NormalizeUri_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(err.code).assertEqual(-1); + console.log('ACTS_NormalizeUri_0600====:' + err); + console.log('ACTS_NormalizeUri_0600====: ' + DAHelper) + try { + DAHelper.normalizeUri( + "errorUri", + ).then((data) => { + console.debug("=ACTS_NormalizeUri_0700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_NormalizeUri_0700==== { + console.debug("=ACTS_NormalizeUri_0700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_NormalizeUri_0700====:' + err); + console.log('ACTS_NormalizeUri_0700====: ' + DAHelper) + try { + DAHelper.normalizeUri( + "errorUri", + (err, data) => { + console.debug("=ACTS_NormalizeUri_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_NormalizeUri_0800====:' + err); + console.log('ACTS_NormalizeUri_0800====: ' + DAHelper) + try { + DAHelper.normalizeUri( + dataAbilityUri3, + ).then((data) => { + console.debug("=ACTS_NormalizeUri_0900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_NormalizeUri_0900==== { + console.debug("=ACTS_NormalizeUri_0900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_NormalizeUri_0900====:' + err); + console.log('ACTS_NormalizeUri_0900====: ' + DAHelper) + try { + DAHelper.normalizeUri( + dataAbilityUri3, + (err, data) => { + console.debug("=ACTS_NormalizeUri_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_NormalizeUri_1000====:' + err); + console.log('ACTS_NormalizeUri_1000====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + dataAbilityUri, + ).then((data) => { + console.debug("=ACTS_DenormalizeUri_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(dataAbilityUri); + console.log('ACTS_DenormalizeUri_0100==== { + console.debug("=ACTS_DenormalizeUri_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_DenormalizeUri_0100====:' + err); + console.log('ACTS_DenormalizeUri_0100====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + dataAbilityUri, + (err, data) => { + console.debug("=ACTS_DenormalizeUri_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(dataAbilityUri); + console.log('ACTS_DenormalizeUri_0200====:' + err); + console.log('ACTS_DenormalizeUri_0200====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + undefined, + ).then((data) => { + console.debug("=ACTS_DenormalizeUri_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0300==== { + console.debug("=ACTS_DenormalizeUri_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_DenormalizeUri_0300====:' + err); + console.log('ACTS_DenormalizeUri_0300====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + undefined, + (err, data) => { + console.debug("=ACTS_DenormalizeUri_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0400====:' + err); + console.log('ACTS_DenormalizeUri_0400====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + "error", + ).then((data) => { + console.debug("=ACTS_DenormalizeUri_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0500==== { + console.debug("=ACTS_DenormalizeUri_0500 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_DenormalizeUri_0500====:' + err); + console.log('ACTS_DenormalizeUri_0500====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + "error", + (err, data) => { + console.debug("=ACTS_DenormalizeUri_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0600====:' + err); + console.log('ACTS_DenormalizeUri_0600====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + 123456, + ).then((data) => { + console.debug("=ACTS_DenormalizeUri_0700 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0700==== { + console.debug("=ACTS_DenormalizeUri_0700 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_DenormalizeUri_0700====:' + err); + console.log('ACTS_DenormalizeUri_0700====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + 123456, + (err, data) => { + console.debug("=ACTS_DenormalizeUri_0800 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0800====:' + err); + console.log('ACTS_DenormalizeUri_0800====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + dataAbilityUri3, + ).then((data) => { + console.debug("=ACTS_DenormalizeUri_0900 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_0900==== { + console.debug("=ACTS_DenormalizeUri_0900 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_DenormalizeUri_0900====:' + err); + console.log('ACTS_DenormalizeUri_0900====: ' + DAHelper) + try { + DAHelper.denormalizeUri( + dataAbilityUri3, + (err, data) => { + console.debug("=ACTS_DenormalizeUri_1000 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(""); + console.log('ACTS_DenormalizeUri_1000====:' + err); + console.log('ACTS_DenormalizeUri_1000==== { + console.debug("=ACTS_OnOff_0100 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(err.code).assertEqual(0); + } + ); + } + } catch (err) { + console.error('=ACTS_OnOff_0100 catch(err)====>:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0100===="); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log('ACTS_OnOff_0200==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_0200 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0200==== { + expect(err.code).assertEqual(0); + console.log('ACTS_OnOff_0200====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0200====" + caller); + if (flagCallback01 == 1 && flagCallback02 == 1 && flagCallback03 == 1) { + clearTimeout(currentAlertTimeout); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0301); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0302); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0303); + console.log('ACTS_OnOff_0300==== { + console.debug('ACTS_OnOff_0300====" + + flagCallback01 + flagCallback02 + flagCallback03); + } + } + try { + expect(typeof (DAHelper)).assertEqual("object"); + + DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0301); + DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0302); + DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0303); + + setTimeout(mySetTimeout, gSetTimeout); + function mySetTimeout() { + DAHelper.notifyChange( + dataAbilityUri, + (err) => { + expect(err.code).assertEqual(0); + waitDone("notifyChange"); + } + ); + } + } catch (err) { + console.error('=ACTS_OnOff_0300 catch(err)====>:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0300====" + + ("json flagCallback02【") + JSON.stringify(flagCallback02) + (" 】") + " , " + flagCallback02); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log('ACTS_OnOff_0400====" + caller); + if (flagCallback01 == 1 && flagCallback02 == 0 && flagCallback03 == 1) { + clearTimeout(currentAlertTimeout); + function mySetTimeout() { + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0401); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0403); + console.log('ACTS_OnOff_0400==== { + console.debug('ACTS_OnOff_0400====" + + flagCallback01 + flagCallback02 + flagCallback03); + } + } + try { + expect(typeof (DAHelper)).assertEqual("object"); + + DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0401); + DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0402); + DAHelper.on("dataChange", dataAbilityUri, onAsyncCallback0403); + + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0402); + + setTimeout(mySetTimeout, gSetTimeout); + function mySetTimeout() { + DAHelper.notifyChange( + dataAbilityUri, + (err) => { + expect(err.code).assertEqual(0); + waitDone("notifyChange"); + } + ); + } + } catch (err) { + console.error('=ACTS_OnOff_0400 catch(err)====>:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0400====" + + ("json err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log('ACTS_OnOff_0500====" + + ("json err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log('ACTS_OnOff_0500====" + + ("json err") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log('ACTS_OnOff_0500==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_0500 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0501); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0502); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0503); + console.log('ACTS_OnOff_0500==== { + console.debug('ACTS_OnOff_0500====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0500====" + caller); + if (flagCallback01 == 2) { + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0600); + DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0600); + console.log('ACTS_OnOff_0600====" + flagCallback01); + } + } + + setTimeout(mySetTimeout, gSetTimeout); + function mySetTimeout() { + DAHelper.notifyChange( + dataAbilityUri, + (err) => { + if (err.code != 0) { + console.debug("=ACTS_OnOff_0600 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0600); + DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0600); + console.log('ACTS_OnOff_0600==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_0600 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0600); + DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0600); + console.log('ACTS_OnOff_0600====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0600==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_0700 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0700); + DAHelper2.off("dataChange", dataAbilityUri2, onAsyncCallback0700); + console.log('ACTS_OnOff_0700==== { + console.debug("=ACTS_OnOff_0700 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(err.code).assertEqual(0); + done(); + } + ); + } + } + ); + } + } catch (err) { + console.error('=ACTS_OnOff_0700 catch(err)====>:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0700==== { + expect(err.code).assertEqual(0); + currentAlertTimeout = setTimeout(() => { + console.log('ACTS_OnOff_0800====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0800==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_0900 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0900==== { + console.debug('ACTS_OnOff_0900====< else true'); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0900====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_0900==== { + currentAlertTimeout = setTimeout(() => { + expect(err.code).assertEqual(0); + console.log('ACTS_OnOff_1000====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1000===="); + expect(err.code).assertEqual(0); + clearTimeout(currentAlertTimeout); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1100); + console.log('ACTS_OnOff_1100==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_1100 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1100==== { + console.debug('ACTS_OnOff_1100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1100===="); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log('ACTS_OnOff_1200==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_1200 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1200); + console.log('ACTS_OnOff_1200==== { + console.debug('ACTS_OnOff_1200====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1200==== { + expect(err.code).assertEqual(0); + setTimeout(() => { + console.log('ACTS_OnOff_1300====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1300===="); + expect(err.code).assertEqual(0); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1400); + console.log('ACTS_OnOff_1400==== { + console.debug("=ACTS_OnOff_1400 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + } + ); + } + } catch (err) { + console.error('=ACTS_OnOff_1400 catch(err)====>:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1400===="); + expect(false).assertTrue(); + } + DAHelper.on(undefined, dataAbilityUri, onAsyncCallback1500); + + setTimeout(mySetTimeout, gSetTimeout); + function mySetTimeout() { + DAHelper.notifyChange( + dataAbilityUri, + (err) => { + expect(err.code).assertEqual(0); + currentAlertTimeout = setTimeout(() => { + console.debug('ACTS_OnOff_1500====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1500===="); + expect(err.code).assertEqual(0); + clearTimeout(currentAlertTimeout); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1600); + console.log('ACTS_OnOff_1600==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_1600 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1600==== { + console.debug('ACTS_OnOff_1600====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1600==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_1700 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1700); + gSetTimeout = 500; + done(); + } else { + currentAlertTimeout = setTimeout(() => { + expect(err.code).assertEqual(0); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1700); + console.log('ACTS_OnOff_1700====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1700===="); + expect(err.code).assertEqual(0); + clearTimeout(currentAlertTimeout); + DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback1800); + console.log('ACTS_OnOff_1800==== { + if (err.code != 0) { + console.debug("=ACTS_OnOff_1800 err=======>" + + ("err【") + JSON.stringify(err) + (" 】") + " , " + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1800==== { + console.debug('ACTS_OnOff_1800====:' + err); + expect(false).assertTrue(); + console.log('ACTS_OnOff_1800==== { + console.debug("=ACTS_ExecuteBatch_Insert_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Insert_0100==== { + console.debug("=ACTS_ExecuteBatch_Insert_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0100====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0100==== { + console.debug("=ACTS_ExecuteBatch_Insert_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Insert_0200==== { + console.debug("=ACTS_ExecuteBatch_Insert_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0200====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0200==== { + console.debug("=ACTS_ExecuteBatch_Insert_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Insert_0300==== { + console.debug("=ACTS_ExecuteBatch_Insert_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0300====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0300==== { + console.debug("=ACTS_ExecuteBatch_Insert_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Insert_0400====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0400==== { + console.debug("=ACTS_ExecuteBatch_Insert_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Insert_0500====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0500==== { + console.debug("=ACTS_ExecuteBatch_Insert_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Insert_0600====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Insert_0600==== { + console.debug("=ACTS_ExecuteBatch_Update_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + + (" 】") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0100 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Update_0100 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Update_0100==== { + console.debug("=ACTS_ExecuteBatch_Update_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0100====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0100==== { + console.debug("=ACTS_ExecuteBatch_Update_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(2); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0200 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Update_0200 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Update_0200==== { + console.debug("=ACTS_ExecuteBatch_Update_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0200====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0200==== { + console.debug("=ACTS_ExecuteBatch_Update_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Update_0300==== { + console.debug("=ACTS_ExecuteBatch_Update_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0300====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0300==== { + console.debug("=ACTS_ExecuteBatch_Update_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + + JSON.stringify(DataAbilityResult) + (" 】;") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0400 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Update_0400 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Update_0400====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0400==== { + console.debug("=ACTS_ExecuteBatch_Update_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(2); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0500 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Update_0500 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Update_0500====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0500==== { + console.debug("=ACTS_ExecuteBatch_Update_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0600 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Update_0600 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Update_0600====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Update_0600==== { + console.debug("=ACTS_ExecuteBatch_Assert_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Assert_0100==== { + console.debug("=ACTS_ExecuteBatch_Assert_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0100====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0100==== { + console.debug("=ACTS_ExecuteBatch_Assert_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Assert_0200==== { + console.debug("=ACTS_ExecuteBatch_Assert_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0200====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0200==== { + console.debug("=ACTS_ExecuteBatch_Assert_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0300 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(""); + console.debug('=ACTS_ExecuteBatch_Assert_0300 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(0); + } + console.debug('ACTS_ExecuteBatch_Assert_0300==== { + console.debug("=ACTS_ExecuteBatch_Assert_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0300====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0300==== { + console.debug("=ACTS_ExecuteBatch_Assert_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Assert_0400====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0400==== { + console.debug("=ACTS_ExecuteBatch_Assert_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_Assert_0500====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0500==== { + console.debug("=ACTS_ExecuteBatch_Assert_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(1); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0600 for data[' + i + '].uri ====>: ' + + data[i].uri) + expect(data[i].uri).assertEqual(""); + console.debug('=ACTS_ExecuteBatch_Assert_0600 for data[' + i + '].count ====>: ' + + data[i].count) + expect(data[i].count).assertEqual(0); + } + console.debug('ACTS_ExecuteBatch_Assert_0600====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Assert_0600==== { + console.debug("=ACTS_ExecuteBatch_Delete_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0100 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Delete_0100 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Delete_0100==== { + console.debug("=ACTS_ExecuteBatch_Delete_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0100====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0100==== { + console.debug("=ACTS_ExecuteBatch_Delete_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(2); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0200 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Delete_0200 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Delete_0200==== { + console.debug("=ACTS_ExecuteBatch_Delete_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0200====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0200==== { + console.debug("=ACTS_ExecuteBatch_Delete_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0300 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Delete_0300 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Delete_0300==== { + console.debug("=ACTS_ExecuteBatch_Delete_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0300====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0300==== { + console.debug("=ACTS_ExecuteBatch_Delete_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0400 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Delete_0400 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Delete_0400====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0400==== { + console.debug("=ACTS_ExecuteBatch_Delete_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(2); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0500 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Delete_0500 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Delete_0500====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0500==== { + console.debug("=ACTS_ExecuteBatch_Delete_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + expect(DataAbilityResult.length).assertEqual(1); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0600 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_Delete_0600 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_Delete_0600====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_Delete_0600==== { + console.debug("=ACTS_ExecuteBatch_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_0100 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_0100 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_0100==== { + console.debug("=ACTS_ExecuteBatch_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0100====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0100==== { + console.debug("=ACTS_ExecuteBatch_0200 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_0200 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + console.debug('=ACTS_ExecuteBatch_0200 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + expect(DataAbilityResult[i].count).assertEqual(1); + } + console.debug('ACTS_ExecuteBatch_0200====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0200==== { + console.debug("=ACTS_ExecuteBatch_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(DataAbilityResult) + (" 】") + DataAbilityResult.length); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_0300 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + console.debug('=ACTS_ExecuteBatch_0300 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + if (i == 2) { + expect(DataAbilityResult[i].uri).assertEqual(""); + expect(DataAbilityResult[i].count).assertEqual(0); + } else { + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + expect(DataAbilityResult[i].count).assertEqual(1); + } + } + console.debug('ACTS_ExecuteBatch_0300==== { + console.debug("=ACTS_ExecuteBatch_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0300====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0300==== { + console.debug("=ACTS_ExecuteBatch_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(DataAbilityResult) + + (" 】;") + DataAbilityResult.length); + for (var i = 0; i < DataAbilityResult.length; i++) { + console.debug('=ACTS_ExecuteBatch_0400 for data[' + i + '].uri ====>: ' + + DataAbilityResult[i].uri) + console.debug('=ACTS_ExecuteBatch_0400 for data[' + i + '].count ====>: ' + + DataAbilityResult[i].count) + if (i == 2) { + expect(DataAbilityResult[i].uri).assertEqual(""); + expect(DataAbilityResult[i].count).assertEqual(0); + } else { + expect(DataAbilityResult[i].uri).assertEqual(dataAbilityUri); + expect(DataAbilityResult[i].count).assertEqual(1); + } + } + console.debug('ACTS_ExecuteBatch_0400====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0400==== { + console.debug("=ACTS_ExecuteBatch_0500 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_0500==== { + console.debug("=ACTS_ExecuteBatch_0500 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0500====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0500==== { + console.debug("=ACTS_ExecuteBatch_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_0600====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0600==== { + console.debug("=ACTS_ExecuteBatch_0700 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_0700==== { + console.debug("=ACTS_ExecuteBatch_0700 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0700====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0700==== { + console.debug("=ACTS_ExecuteBatch_0800 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_0800====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0800==== { + console.debug("=ACTS_ExecuteBatch_0900 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_0900==== { + console.debug("=ACTS_ExecuteBatch_0900 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0900====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_0900==== { + console.debug("=ACTS_ExecuteBatch_1000 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_1000====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_1000==== { + console.debug("=ACTS_ExecuteBatch_1100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_1100==== { + console.debug("=ACTS_ExecuteBatch_1100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_1100====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_1100==== { + console.debug("=ACTS_ExecuteBatch_1200 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + + (" 】;") + data.length); + expect(data.length).assertEqual(0); + console.debug('ACTS_ExecuteBatch_1200====:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + console.debug('ACTS_ExecuteBatch_1200====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); + expect(typeof (rDAHelper)).assertEqual("object"); + rDAHelper.release().then((data) => { + console.debug("=ACTS_Release_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data).assertEqual(true); + console.log('ACTS_Release_0100==== { + console.debug("=ACTS_Release_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Release_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Release_0100====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); + expect(typeof (rDAHelper)).assertEqual("object"); + rDAHelper.release((err, data) => { + console.debug("=ACTS_Release_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('featureAbility getDataAbilityHelper ACTS_Release_0200 data: ' + data) + expect(data).assertEqual(true); + console.log('ACTS_Release_0200====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Release_0200====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); + expect(typeof (rDAHelper)).assertEqual("object"); + rDAHelper.release().then((data) => { + console.debug("=ACTS_Release_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data).assertEqual(true); + rDAHelper.release().then((data) => { + console.debug("=ACTS_Release_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data).assertEqual(false); + console.log('ACTS_Release_0300==== { + console.debug("=ACTS_Release_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Release_0300==== { + console.debug("=ACTS_Release_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Release_0300====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Release_0300====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); + expect(typeof (rDAHelper)).assertEqual("object"); + rDAHelper.release((err, data) => { + console.debug("=ACTS_Release_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('featureAbility getDataAbilityHelper ACTS_Release_0400 data: ' + data) + expect(data).assertEqual(true); + rDAHelper.release((err, data) => { + console.debug("=ACTS_Release_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" ,") + JSON.stringify(data) + (" 】;")); + console.log('featureAbility getDataAbilityHelper ACTS_Release_0400 data: ' + data) + expect(data).assertEqual(false); + console.log('ACTS_Release_0400====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Release_0400====/system/app/ActsSpecifiedUserActionextensionZeroTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ], + "teardown-command":[ + "acm delete -i 101", + "acm delete -i 102" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensiononeTest.hap->/system/app/ActsSpecifiedUserActionextensiononeTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + } + ] +} + diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..196c3b8b3760abbd14b1e6b6d28e609dcf1b85bd --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,24 @@ +/* + * 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; + globalThis.startnum = 0 + console.log("MyAbilityStage finish") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..77038a5e923d6947c4419b4c9f0365e72b2327a7 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..892ee1bfb3bd2e6686d3e2f2d2f617f1730f290e --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,58 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index", null) + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + 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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a1e4947d0bf77fc0af62c6df3d070dc1b95bb73 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,230 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import rpc from '@ohos.rpc'; +import osaccount from '@ohos.account.osAccount' +globalThis.ACCOUNT_ID100; +globalThis.ACCOUNT_ID101; +globalThis.ACCOUNT_ID102; +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + // process client's request + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} + +function onConnectCallback(element) { + console.log('connectAbilityWithAccount onConnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onConnect element.abilityName : ' + element.abilityName) +} + +function onDisconnectCallback(element) { + console.log('connectAbilityWithAccount onDisconnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onDisconnect element.abilityName : ' + element.abilityName) +} + +function onFailedCallback(code) { + console.log('connectAbilityWithAccount onFailed errCode : ' + code) +} + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate'); + } + onDestory(){ + console.log('ServiceAbility onDestory'); + } + onRequest(want,startId) { + console.log('ServiceAbility onRequest'); + } + + onConnect(want) { + console.log('ServiceAbility onConnect'); + console.log('globalThis.startnum is ' + globalThis.startnum); + + switch (globalThis.startnum) { + case 1: + console.log('ServiceAbility case 1'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },globalThis.ACCOUNT_ID100 ,{ + windowMode: 2, + displayId: 1 + }).then(() => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0100 ====>success!") + }) + console.debug("====>case 1 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 2: + console.log('ServiceAbility case 2'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },globalThis.ACCOUNT_ID102 ,{ + windowMode: 2, + displayId: 1 + }).then(() => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0300 ====>success!") + }) + console.debug("====>case 2 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 3: + console.log('ServiceAbility case 3'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.MainAbility2' + },globalThis.ACCOUNT_ID101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0500====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_0500====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 3 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 4: + console.log('ServiceAbility case 4'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },globalThis.ACCOUNT_ID102, { + windowMode: 2, + displayId: 1 + },((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0600====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_0600====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 4 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 5: + console.log('ServiceAbility case 5'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + },globalThis.ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0700====>success!"+ JSON.stringify(data)) + }) + break; + case 6: + console.log('ServiceAbility case 6'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + },globalThis.ACCOUNT_ID102,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0900====>fail!!!") + console.log("====>end ACTS_StartServiceAbilityWithAccount_0900====>sunccess!") + })) + console.debug("====>case 6 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 7: + console.log('ServiceAbility case 7'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' + }, globalThis.ACCOUNT_ID101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_1100====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_1100====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 7 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 8: + console.log('ServiceAbility case 8'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + }, globalThis.ACCOUNT_ID102,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_1200====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_1200====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 8 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 9: + console.log('ServiceAbility case 9'); + this.context.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + }, globalThis.ACCOUNT_ID100, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + },) + break; + case 10: + console.log('ServiceAbility case 10'); + this.context.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + },globalThis.ACCOUNT_ID102, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + },) + + console.debug("====>case 10 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + default: + console.log("====> ServiceAbility end default =====>") + break; + } + } + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..c70f0a2d3cfda08ff3f4038d37128a08c013d16a --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,60 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import Want from '@ohos.application.Want'; +import commonEvent from "@ohos.commonEvent" +import rpc from '@ohos.rpc'; + +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + this.context.terminateSelf(); + console.log("====> terminateSelf End=====>") + }); + } + + onConnect(want: Want) { + console.log('ServiceAbility2 onConnect'); + if (want.action == 'StartAbilityPromise') { + console.log('stub StartAbilityPromise OnConnect start '); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + this.context.terminateSelf(); + console.log("====> StartAbilityPromise End=====>") + }); + } + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae1248c48c93d453fcd7eda5a426fcb47cbe59c0 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3586361441e1111245eadf7c2c8da640d5b44ee --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,833 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +import osaccount from '@ohos.account.osAccount' + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; + +const START_ABILITY_TIMEOUT = 3000; +console.debug("====>in Ability.test====>"); + +export default function abilityTest(abilityContext) { + console.debug("====>in ACTS_InterfaceMultiUsers====>"); + describe('ACTS_StartService', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + globalThis.ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + globalThis.ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + globalThis.ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0100 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : In multi-user non-concurrent mode, + * the specified user is equal to the current user and the user's task list exists (promise) + */ + it('ACTS_StartServiceAbilityWithAccount_0100', 0, async function (done) { + let Subscriber + var flag = true; + var startresult = false; + globalThis.startnum = 1; + + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0100 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0100 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0100start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(() => { + done() + }, 1000) + } + + function timeout() { + console.debug('in ACTS_StartServiceAbilityWithAccount_0100 timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_StartServiceAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0300 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0300', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 2; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0300start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0500 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_0500', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 3; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + // setTimeout(() => { + + // }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0500 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0500 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0500 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + done(); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0500start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0600 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), + * call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_0600', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 4; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0600 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0600 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0600 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0600start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0700 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user, + * and the user's task list exists, call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0700', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 5; + + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0700start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(() => { + done() + }, 1000) + } + + function timeout() { + console.debug('in ACTS_StartServiceAbilityWithAccount_0700 timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_StartServiceAbilityWithAccount_0700 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0900 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), + * call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0900', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 6; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0900 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0900 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0900 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0900start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_1100 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_1100', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 7; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_1100 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_1100 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_1100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>1100start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_1200 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), + * call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_1200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 8; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_1200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_1200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_1200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>1200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0100 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user and the user's task list exists + */ + it('ACTS_ConnectServiceAbilityWithAccount_0100', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 9; + + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0100 ConnectServiceAbility connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(() => { + done() + }, 1000) + } + + function timeout() { + console.debug('in ACTS_ConnectServiceAbilityWithAccount_0100 timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_ConnectServiceAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0300 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist) + */ + it('ACTS_ConnectServiceAbilityWithAccount_0300', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 10; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectServiceAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_ConnectServiceAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0300 ConnectServiceAbility connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + }) +} diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..14db1352021eca93318bfef24eaece89517e9ba8 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,23 @@ +/* + * 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 abilityTest from './Ability.test.ets' + + +export default function testsuite(context) { + + console.debug("====>in list.test====>"); + abilityTest(context) + +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..79e3b5316dd06122aba615f800d0d68fcd361d3f --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json @@ -0,0 +1,131 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractionextensionzerotest.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" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractionextensionzerotest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsspecifieduseractionextensionzerotest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3af7577046c529ec844fd187c327d9fe488f38d9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractionextensiononetest", + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fed06e990bb311e6f04b4fa3c1d8d03827329b6b --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json @@ -0,0 +1,67 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsspecifieduseractionextensiononetest", + "shell-timeout": "300000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ], + "teardown-command":[ + "acm delete -i 101", + "acm delete -i 102" + ] + }, + { + "test-file-name": [ + "ActsSpecifiedUserActionextensiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensiononeTest.hap->/system/app/ActsSpecifiedUserActionextensiononeTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + }, + + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensionZeroTest.hap->/system/app/ActsSpecifiedUserActionextensionZeroTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 101" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..70b1618e9cc97658683c4577d275da01f37dbf41 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + globalThis.stageContext = this.context; + globalThis.startnum = 0 + console.log("MyAbilityStage finish") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8be28c127eab8f0e5bf9522ea34f0817021db14c --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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 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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea606f68626946be6167c55ca8a9b745b19c21f5 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index", null) + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + 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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..83124f2c7e9d32cd4b7b13fa46c1aaf972922493 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,144 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import rpc from '@ohos.rpc'; +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + // process client's request + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} + +function onConnectCallback(element) { + console.log('connectAbilityWithAccount onConnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onConnect element.abilityName : ' + element.abilityName) +} + +function onDisconnectCallback(element) { + console.log('connectAbilityWithAccount onDisconnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onDisconnect element.abilityName : ' + element.abilityName) +} + +function onFailedCallback(code) { + console.log('connectAbilityWithAccount onFailed errCode : ' + code) +} + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate'); + } + onDestory(){ + console.log('ServiceAbility onDestory'); + } + onRequest(want,startId) { + console.log('ServiceAbility onRequest'); + } + + onConnect(want) { + console.log('ServiceAbility onConnect'); + console.log('globalThis.startnum is ' + globalThis.startnum); + + switch (globalThis.startnum) { + case 1: + console.log('ServiceAbility case 1'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },100, { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0200 ====>success!") + }) + console.debug("====>case 1 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + break; + + case 2: + console.log('ServiceAbility case 2'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + }, globalThis.ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0800====>success!"+ JSON.stringify(data)) + }) + console.debug("====>case 3 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + + case 3: + console.log('ServiceAbility case 3'); + this.context.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + }, globalThis.ACCOUNT_ID100, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + },) + console.debug("====>case 5 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 4: + console.log('ServiceAbility case 4'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' + },101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_1000====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_1000====>sunccess!"+ JSON.stringify(data)) + })) + break; + case 5: + console.log('ServiceAbility case 5'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' + }, globalThis.ACCOUNT_ID101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0400====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_0400====>sunccess!"+ JSON.stringify(data)) + })) + break; + default: + console.log("====> ServiceAbility end default =====>") + break; + } + } + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..bedb302158f3ca7dc5fcda757bbca056c27a63e3 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import Want from '@ohos.application.Want'; +import commonEvent from "@ohos.commonEvent" +import rpc from '@ohos.rpc'; + +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + this.context.terminateSelf(); + console.log("====> terminateSelf End=====>") + }); + } + + onConnect(want: Want) { + console.log('ServiceAbility2 onConnect'); + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..43f30ae365e727a0006bc0bba273e6efff796f19 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..35c02872784a50cbc3d3daa0be7d59fd82737167 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,458 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +import osaccount from '@ohos.account.osAccount' + + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; + +const START_ABILITY_TIMEOUT = 3000; +console.debug("====>in Ability.test====>"); + +export default function abilityTest(abilityContext) { + console.debug("====>in ACTS_InterfaceMultiUsers====>"); + describe('ACTS_StartService', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + globalThis.ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + globalThis.ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + globalThis.ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0200 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 1; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0800 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0800', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 2; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + done(); + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0800 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0800 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0800 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0800start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0200 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists + */ + it('ACTS_ConnectServiceAbilityWithAccount_0200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 3; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>ACTS_ConnectServiceAbilityWithAccount_0200 disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>ACTS_ConnectServiceAbilityWithAccount_0200 in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_ConnectServiceAbilityWithAccount_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 0200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_1000 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_1000', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 4; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_1000 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_1000 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_1000 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>1000start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0400 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_0400', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 5; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0400 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0400 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0400 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0400start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4436395534f304976110ce8ce85ca2e7ac9984f4 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets @@ -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. + */ +import abilityTest from './Ability.test.ets' + + +export default function testsuite(context) { + + console.debug("====>in list.test====>"); + abilityTest(context) + +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..3b963d0c7cc3048040d7dd89c4c50d2b534ef801 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json @@ -0,0 +1,131 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractionextensiononetest.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" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractionextensiononetest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsspecifieduseractionextensiononetest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractionextensiononetest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..51a7178ef9945ef296bbb58c0ec19f2f3ccaae7a --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractionzerotest", + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/Test.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..50653b9cfccaae4dfeadb0669ca6c3d6a07ab271 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/Test.json @@ -0,0 +1,50 @@ + +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsspecifieduseractionzerotest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSpecifiedUserActionZeroTest.hap", + "ActsSpecifiedUserActiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionZeroTest.hap->/system/app/ActsSpecifiedUserActionZeroTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActiononeTest.hap->/system/app/ActsSpecifiedUserActiononeTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ], + "teardown-command":[ + "acm delete -i 101", + "acm delete -i 102" + ] + } + +] +} + diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..08dee12306de669ae4e52f53c5234d98461148f4 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..69a9a4bac10f41ef5d60cbc5bb1aa90f85d7dc50 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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; + } + + 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") + globalThis.abilityContext = this.context + 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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..209189314ea2c328102dbee3a923d99b898447a8 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,57 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index", null) + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae1248c48c93d453fcd7eda5a426fcb47cbe59c0 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..72baf47de53d1392864356c566692a78e02d9ff6 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,22 @@ +/* + * 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 abilityTest from './abilityTest.ets' + + +export default function testsuite(context) { + + abilityTest(context) + +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7951c6ae3b79bac98003419005f88ba92e796fb9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets @@ -0,0 +1,935 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent'; +import osaccount from '@ohos.account.osAccount' + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; +var ACCOUNT_ID100; +var ACCOUNT_ID101; +var ACCOUNT_ID102; + +const START_ABILITY_TIMEOUT = 3000; +export default function abilityTest(abilityContext) { + describe('ACTS_AbilityContext', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + + /* + * @tc.number: ACTS_StartStandardAbilityWithAccount_0100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the AbilityContext::startAbilityWithAccount interface of + * Promise (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0100====>start") + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_StartStandardAbilityWithAccount_0100 UnSubscribeCallback====>"); + setTimeout(function(){ + done(); + },2000) + } + + function timeout() { + if(flag == false) { + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_0100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0100====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0300 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::startAbilityWithAccount interface of + * Promise (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0300', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0300 ====> start") + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0300 ====> timeout'); + done(); + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility12' + },ACCOUNT_ID102, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0300====>success!"+ JSON.stringify(data)) + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0500 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AbilityContext::startAbilityWithAccount interface + * of AsyncCallback (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0500', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0500 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0500====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0500 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0500====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0600 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (with the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0600', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0600 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0600====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0600 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102, { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0600====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0700 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the + * AbilityCont. + * ext::startAbilityWithAccount interface of Promise (without the StartOptions parameter) + * to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0700', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0700 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0700====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_StartStandardAbilityWithAccount_0700 UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false) { + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_0700 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0700====>success!"+ JSON.stringify(data)) + }) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0900 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call + * the AbilityContext::startAbilityWithAccount interface of + * Promise (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0900', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0900 ====> start") + + var Subscriber; + + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0900====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0900 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0900====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_1100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_1100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_1100 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_1100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_1100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_1100====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_1200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_1200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_1200 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_1200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_1200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102,((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_1200====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityForResultWithAccount + * (with the StartOptions parameter) interface to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0100 ====> start") + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_StartStandardAbilityForResultWithAccount_0100 UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0100====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0300 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface of Promise to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0300', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0300 ====> start") + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0300 ====> timeout'); + done(); + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0300====>success!"+ JSON.stringify(data)) + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0500 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the + * AsyncCallback's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0500', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0500 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0500====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0500 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0500 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0600 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) interface of + * AsyncCallback to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0600', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0600 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0600====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0600 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID102, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0600 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0700 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityForResultWithAccount + * (without the StartOptions parameter) interface to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0700', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0700 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0700====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false) + { + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0700 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0700====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0900 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityForResultWithAccount (no StartOptions parameter) interface of + * Promise to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0900', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0900 ====> start") + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0900 ====> timeout'); + done(); + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0900====>success!"+ JSON.stringify(data)) + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AsyncCallback's + * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) interface + * to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_1100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1100 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_1100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_1100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1100 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::startAbilityForResultWithAccount (no StartOptions parameter) + * interface of AsyncCallback to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_1200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1200 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_1200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID102, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1200 === success!" + JSON.stringify(data)) + })) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_1200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /** + * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is equal to the current user and the user's task list exists, + * call the AbilityContext::connectAbilityWithAccount interface to connect to Ability. + */ + it('ACTS_ConnectStandardAbilityWithAccount_0100', 0, async function (done) { + console.log("ACTS_ConnectStandardAbilityWithAccount_0100====>start") + var Subscriber; + var flag = true; + var number = 0; + + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectStandardAbilityWithAccount_0100 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectStandardAbilityWithAccount_0100 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>WithAccount 0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(number).then((err)=>{ + console.debug("====>err is====>" + JSON.stringify(err)); + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_ConnectStandardAbilityWithAccount_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_ConnectStandardAbilityWithAccount_0100 UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false) { + expect().assertFail(); + console.debug('ACTS_ConnectStandardAbilityWithAccount_0100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start connectAbilityWithAccount====>"); + number = await abilityContext.connectAbilityWithAccount({ + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + }, ACCOUNT_ID100,{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + }) + + /** + * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0300 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::connectAbilityWithAccount interface to connect the Ability. + */ + it('ACTS_ConnectStandardAbilityWithAccount_0300', 0, async function (done) { + console.log("ACTS_ConnectStandardAbilityWithAccount_0300 ====> start") + var Subscriber; + var flag = true; + var number = 0; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>WithAccount 0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(number).then((err)=>{ + console.debug("====>err is====>" + JSON.stringify(err)); + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectStandardAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectStandardAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_ConnectStandardAbilityWithAccount_0300====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start connectAbilityWithAccount====>"); + number = await abilityContext.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + },ACCOUNT_ID102 ,{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..c353cc06d91ebac5b8cb4ca3e44cafb450d8b42a --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json @@ -0,0 +1,122 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractionzerotest.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" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractionzerotest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractionzerotest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..9b04e81d77e7570aff3a3af7a9c792358af952ea --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractiononetest", + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/Test.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a8c171bda36735c5943541d63d88791a045ab5ea --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/Test.json @@ -0,0 +1,63 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsspecifieduseractiononetest", + "shell-timeout": "300000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ] + }, + { + "test-file-name": [ + "ActsSpecifiedUserActiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActiononeTest.hap->/system/app/ActsSpecifiedUserActiononeTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + }, + + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionZeroTest.hap->/system/app/ActsSpecifiedUserActionZeroTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 101" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..8375d549288c1fc101c0ab596545af9d626118da --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..69a9a4bac10f41ef5d60cbc5bb1aa90f85d7dc50 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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; + } + + 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") + globalThis.abilityContext = this.context + 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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..6176b8ae0398e0573d77f1d005f1011fa6f323a0 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,57 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae1248c48c93d453fcd7eda5a426fcb47cbe59c0 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5635f2840894a3a90336344a0d439a5e2942b166 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,22 @@ +/* + * 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 abilityTest from './abilityTest.ets' + + +export default function testsuite(context) { + + abilityTest(context) + +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..470e2e0f645240b347bea3b4d4f11b653370d7a9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets @@ -0,0 +1,540 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent'; +import osaccount from '@ohos.account.osAccount' + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; +var ACCOUNT_ID100; +var ACCOUNT_ID101; +var ACCOUNT_ID102; + +const START_ABILITY_TIMEOUT = 3000; +export default function abilityTest(abilityContext) { + describe('ACTS_AbilityContext', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityWithAccount + * interface (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0200====>start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0200====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0400 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0400', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0400 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0400====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_0400 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0400====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0800 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityWithAccount + * interface (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0800', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0800 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0800====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0800 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0800====>success!"+ JSON.stringify(data)) + }) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_1000 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_1000', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_1000 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_1000====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_1000 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_1000====>success!!!" + JSON.stringify(data)) + })) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the + * Promise's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0200 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0200====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0400 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the + * AsyncCallback's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0400', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0400 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0400====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0400 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("StartStandardAbilityForResultWithAccount_0400 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0800 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the Promise's + * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) interface + * to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0800', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0800 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0800====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0800 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0800====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1000 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AsyncCallback's + * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) + * interface to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_1000', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1000 ====> start") + var flag = false; + var Subscriber; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_1000====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_1000 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + + } + } + + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1000 === success!" + JSON.stringify(data)) + })) + }) + + + /** + * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AbilityContext::connectAbilityWithAccount interface to connect the Ability. + */ + it('ACTS_ConnectStandardAbilityWithAccount_0200', 0, async function (done) { + console.log("ACTS_ConnectStandardAbilityWithAccount_0200 ====> start") + var Subscriber; + var flag = true; + var number = 0; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>WithAccount 0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(number).then((err)=>{ + console.debug("====>err is====>" + JSON.stringify(err)); + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectStandardAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectStandardAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_ConnectStandardAbilityWithAccount_0200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start connectAbilityWithAccount====>"); + number = await abilityContext.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + },ACCOUNT_ID102 ,{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d1014c0d76671e6ac62a405d793da2ae7d26cfcb --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json @@ -0,0 +1,110 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractiononetest.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" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractiononetest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractiononetest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b b/ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/BUILD.gn b/ability/ability_runtime/actsstserviceabilityclientcase/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/BUILD.gn rename to ability/ability_runtime/actsstserviceabilityclientcase/BUILD.gn diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/Test.json b/ability/ability_runtime/actsstserviceabilityclientcase/Test.json similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/Test.json rename to ability/ability_runtime/actsstserviceabilityclientcase/Test.json diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/config.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/config.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/app.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/app.js rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/signature/openharmony_sx.p7b b/ability/ability_runtime/actsstserviceabilityclientcase/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsstserviceabilityclientcase/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/BUILD.gn rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/BUILD.gn diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/Test.json rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/Test.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/AbilityStage.ts b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5ebbe661dc5aa73cb877d8a4c9d829ca6cf4b2b --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.AbilitySatage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate"); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c89305ea6db4b5ac3f7286b9657f6f7ca8074c72 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,44 @@ +/* + * 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) { + console.log("jws onCreate"); + } + + onDestroy() { + console.log("jws onDestroy"); + } + + onWindowStageCreate(windowStage) { + console.log("jws onWindowStageCreate"); + } + + onWindowStageDestroy() { + console.log("jws onWindowStageDestroy"); + } + + onForeground() { + console.log("jws onForeground"); + } + + onBackground() { + console.log("jws onBackground"); + } + + call(){ + + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/app.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb4d987484da3f51b600dd92f40a7996f8f92162 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bc26cd000f36f57d4f30f2710cdd08b6fc2d4c80 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ServiceExtAbility" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + }, + { + "name": "description_dataability", + "value": "hap sample empty provider" + }, + { + "name": "description_mainability2", + "value": "eTS_Empty Ability" + }, + { + "name": "entry_MainAbility2", + "value": "entry_MainAbility2" + }, + { + "name": "description_testdataability", + "value": "hap sample empty provider" + }, + { + "name": "permreason_dataability", + "value": "request dataability premission" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/actsstserviceabilityclientcase/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/app.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ac69de9d75e0483c9d396bd8c06ecc7e6996bb4c --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.acts.actsinterfacemultiusersextensiontest", + "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/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/Test.json rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..69bd30f43010522ddda8fc48abb21c69d9936d2c --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,53 @@ +/* + * 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 Ability from '@ohos.application.Ability' +import commonEvent from "@ohos.commonEvent" + +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility2 onCreate"); + globalThis.abilityContext = this.context + } + + onDestroy() { + console.log("MainAbility2 onDestroy"); + } + + onWindowStageCreate(windowStage) { + console.log("MainAbility2 onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index/second", null); + commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => { + console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") + globalThis.abilityContext.terminateSelf().then(() => { + commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ + console.log('terminateSelf promise'); + }); + }); + }) + } + + onWindowStageDestroy() { + console.log("MainAbility2 onWindowStageDestroy"); + } + + onForeground() { + console.log("MainAbility2 onForeground"); + } + + onBackground() { + console.log("MainAbility2 onBackground"); + } +}; diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d589e3d095c8c8899b9f412478a188b0bb20651 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,53 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonEvent" +import rpc from '@ohos.rpc'; + +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => { + console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") + this.context.terminateSelf().then(() => { + commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ + console.log('terminateSelf promise'); + }); + }); + }) + } + + onConnect(want) { + console.log('ServiceAbility2 onConnect'); + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd39208788d8fdb66d3c7fbff8afefb2763dda90 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + globalThis.abilityWant.parameters['timeout'] = 10000 + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + 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/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2bb0df57e996dbcb344945d19e75b84d5ed6b2a4 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,974 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +import osaccount from '@ohos.account.osAccount' + +var subscriberInfo_MainAbility = { + events: ["ACTS_InterfaceMultiUsersExtension_CommonEvent"] + }; +var subscriberInfo_MainAbility2 = { + events: ["ACTS_TerminateSelf_CommonEvent"] +}; +var subscriberInfo_MainAbility3 = { + events: ["ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"] +}; +var osAccountManager +const START_ABILITY_TIMEOUT = 6000; +globalThis.number = 0; +console.debug("====>in Ability.test====>"); +export default function abilityTest(abilityContext) { + console.debug("====>in function abilityTest====>"); + describe('ActsInterfaceMultiUsersExtensionTest', function () { + afterAll(function() { + osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + osAccountManager.removeOsAccount(101, (err)=>{ + console.debug("====>remove localId: 101" + " err:" + JSON.stringify(err)); + }) + }) + }) + console.debug("====>in ACTS_InterfaceMultiUsers====>"); + /* + * @tc.number : ACTS_ExtensionStartAbility_0100 + * @tc.name : start new ability + * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) + */ + it('ACTS_ExtensionStartAbility_0100', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 1 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0100start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionStartAbility_0100 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionStartAbility_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0200 + * @tc.name : start new ability + * @tc.desc : Start an ability with the parameter startability with options failed.(promise) + */ + it('ACTS_ExtensionStartAbility_0200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 2 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect().assertFail(); + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(()=>{ + done(); + },1000) + } + function onConnectCallback(element, remote) { + console.log(' onConnectCallback====> element=' + JSON.stringify(element)); + console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ExtensionStartAbility_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0300 + * @tc.name : start new ability + * @tc.desc : Start an ability with the parameter startability with options succeeded.(callback) + */ + it('ACTS_ExtensionStartAbility_0300', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum=3 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0300start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionStartAbility_0300 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionStartAbility_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0400 + * @tc.name : start new ability + * @tc.desc : Start an ability with the parameter startability with options failed.(callback) + */ + it('ACTS_ExtensionStartAbility_0400', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 4 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect().assertFail(); + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(()=>{ + done(); + },1000) + } + function onConnectCallback(element, remote) { + console.log(' onConnectCallback====> element=' + JSON.stringify(element)); + console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ExtensionStartAbility_0400 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0400start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0500 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(promise) + */ + it('ACTS_ExtensionStartAbility_0500', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 5 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0500start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionStartAbility_0500 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionStartAbility_0500 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0600 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability failed.(promise) + */ + it('ACTS_ExtensionStartAbility_0600', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 6 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect().assertFail(); + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(()=>{ + done(); + },1000) + } + function onConnectCallback(element, remote) { + console.log(' onConnectCallback====> element=' + JSON.stringify(element)); + console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ExtensionStartAbility_0600 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0600start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0700 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_ExtensionStartAbility_0700', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum=7 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0700start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionStartAbility_0700 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionStartAbility_0700 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0800 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability failed.(callback) + */ + it('ACTS_ExtensionStartAbility_0800', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 8 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect().assertFail(); + expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(()=>{ + done(); + },1000) + } + function onConnectCallback(element, remote) { + console.log(' onConnectCallback====> element=' + JSON.stringify(element)); + console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ExtensionStartAbility_0800 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0800start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_0900 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_ExtensionStartAbility_0900', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum=13 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent").assertTrue(); + console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility3).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0900start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionStartAbility_0900 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionStartAbility_0900 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + + }) + + /* + * @tc.number : ACTS_ExtensionStartAbility_1000 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_ExtensionStartAbility_1000', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum=14 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent").assertTrue(); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility3).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>1000start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionStartAbility_1000 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionStartAbility_1000 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + + }) + + /* + * @tc.number : ACTS_ExtensionTerminateSelf_0100 + * @tc.name : Use terminateself to terminate ability + * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(promise) + */ + it('ACTS_ExtensionTerminateSelf_0100', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 9 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function onConnectCallback(element, remote) { + console.log('onConnectCallback====> element=' + JSON.stringify(element)); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0100start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionTerminateSelf_0100 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionTerminateSelf_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + /* + * @tc.number : + * @tc.name : Use terminateself to terminate ability + * @tc.desc : Starting mainability2 with startAbility then terminateself ability failed.(promise) + */ + it('ACTS_ExtensionTerminateSelf_0200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 10 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect().assertFail(); + expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(()=>{ + done(); + },1000) + } + function onConnectCallback(element, remote) { + console.log(' onConnectCallback====> element=' + JSON.stringify(element)); + console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug(' - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + }) + /* + * @tc.number : ACTS_ExtensionTerminateSelf_0300 + * @tc.name : Use terminateself to terminate ability + * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(callback) + */ + it('ACTS_ExtensionTerminateSelf_0300', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 11 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); + console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0300start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(()=>{ + done() + },1000) + } + + function timeout() { + console.debug('in ACTS_ExtensionTerminateSelf_0300 timeout'); + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_ExtensionTerminateSelf_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + + }) + /* + * @tc.number : ACTS_ExtensionTerminateSelf_0400 + * @tc.name : Use terminateself to terminate ability + * @tc.desc : Starting mainability2 with startAbility then terminateself ability failed.(callback) + */ + it('ACTS_ExtensionTerminateSelf_0400', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 12 + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + function SubscribeCallBack (err, data) { + expect().assertFail(); + expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(()=>{ + done(); + },1000) + } + function onConnectCallback(element, remote) { + console.log('ACTS_ExtensionTerminateSelf_0400 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ExtensionTerminateSelf_0400 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ExtensionTerminateSelf_0400 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0400start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + },{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..44fb329d102294cbc0c065ed70a99d2a454bb082 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/module.json @@ -0,0 +1,120 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.actsinterfacemultiusersextensiontest.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" + ] + } + ] + }, + { + "name": "com.acts.actsinterfacemultiusersextensiontest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait" + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "name": "com.acts.actsinterfacemultiusersextensiontest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION" + } + ], + "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.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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.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.MANAGE_LOCAL_ACCOUNTS", + "reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" + }, + { + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", + "reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" + } + ] + } +} diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersApi7AppA/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/app.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..12dc0a920dd7326b97725641ebdf8126179c3c64 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.acts.killprocesshap", + "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/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5e0fe0295965a36a6860393da1a9ef92051c2ecd --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsUsersKillProcessAppA") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsUsersKillProcessAppA" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsuserskillprocessappa_js_assets", + ":actsamsuserskillprocessappa_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsuserskillprocessappa_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsuserskillprocessappa_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsuserskillprocessappa_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsuserskillprocessappa_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/Test.json rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/Test.json diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4fe28ae15919af11a26f4f09be7f7de506a96f5 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_KillProcess====>"); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + commonEvent.publish("ACTS_KillProcess", PublishCallBackOne); + } + + 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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7c50780a282fac6917578612e8e8870070b881a8 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.killprocesshap.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" + ] + } + ] + } + ] + + } +} diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/app.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..5acc8f76a7102c4d9f3e7f0ae61a5c167497ba37 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.acts.killprocessthirdhap", + "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/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1cee2c8265a9ecc77cf78c672dd4174f58ed4830 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsUsersKillProcessAppB") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsUsersKillProcessAppB" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsuserskillprocessappb_js_assets", + ":actsamsuserskillprocessappb_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsuserskillprocessappb_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsuserskillprocessappb_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsuserskillprocessappb_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsuserskillprocessappb_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/Test.json rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/Test.json diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3d2af559bce9a478ec2ce68a7377a28907910e1 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import appManager from '@ohos.application.appManager' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context + 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") + console.log("in killhap onForeground") + setTimeout(()=>{ + appManager.killProcessesByBundleName('com.example.killprocessthirdhap').then((data)=>{ + console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) + }) + },2000) + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..99b6752f5e1704f1a5d4da4837ddbf71452b2376 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.killprocessthirdhap.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/app.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..fd6cc615352aace4dab99bc51f675ed9d0654d6c --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.acts.killprocessthirdhap2", + "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/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cd1e0ed22f9ef55fbee7c0250c4dbdd656c99a88 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsUsersKillProcessAppC") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsUsersKillProcessAppC" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsuserskillprocessappc_js_assets", + ":actsamsuserskillprocessappc_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsuserskillprocessappc_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsuserskillprocessappc_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsuserskillprocessappc_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsuserskillprocessappc_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/Test.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/Test.json rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/Test.json diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..3eaadf9ce0fde2bfcb4820b84904bcb42c190c2b --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import appManager from '@ohos.application.appManager' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context + 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") + console.log("in killhap onForeground") + setTimeout(()=>{ + appManager.killProcessesByBundleName('com.example.killprocessthirdhap2',(err,data)=>{ + console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) + }) + },2000) + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..933db7e827ece3a4db232a4e3620b2df9e6acb15 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.killprocessthirdhap2.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/AppScope/app.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/AppScope/app.json rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/AppScope/app.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/BUILD.gn rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/BUILD.gn diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/Test.json rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/Test.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c12571f077e3f3d2e4624c7904bd78811c477c18 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,49 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonEvent" +import rpc from '@ohos.rpc'; + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate'); + } + onDestory(){ + console.log('ServiceAbility onDestory'); + } + onRequest(want,startId) { + console.log('ServiceAbility onRequest'); + commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", () => { + console.log(" Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") + this.context.terminateSelf().then(()=>{ + console.log(" terminateSelf callback") + }) + }) + } + + onConnect(want) { + console.log('ServiceAbility onConnect'); + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect'); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..984b76dc28d0ae1a82dfc54b06dfed500280a187 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + globalThis.abilityWant.parameters['timeout'] = 20000 + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + 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/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4e1c2a61d343de3599bfc16768af46c3df792b0 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test.ets' + +export default function testsuite(context) { + console.debug("====>in list.test====>"); + abilityTest(context) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersSystemTest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsusers/BUILD.gn b/ability/ability_runtime/actsusers/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/BUILD.gn rename to ability/ability_runtime/actsusers/BUILD.gn diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/app.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6ff764e5d925141247e1b2aeba1f4acfd38467fb --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsconnectabilitysystemabilitytest", + "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/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9af58d08c9fc540c0af0f7a3b97dfca6cabe4ba6 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json @@ -0,0 +1,31 @@ + +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "120000", + "package": "com.example.actsconnectabilitysystemabilitytest", + "shell-timeout": "60000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm switch -i 101" + ], + "teardown-command":[ + "acm delete -i 101" + ] + }, + { + "test-file-name": [ + "ActsConnectAbilitySystemAbilityTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + + ] +} + diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f1ff325c560d0a7bcd46ca7ec852ddebfd7fb86e --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,42 @@ +import Ability from '@ohos.application.Ability' +// import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("AbilityMultiInstanceTest onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceTest onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceTest onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceTest onWindowStageDestroy") + } + + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceTest onForeground") + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceTest onBackground") + } + +}; diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fecdd4113bf546cbec432e67c90078f297b88bd --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,256 @@ +/* + * 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 commonEvent from '@ohos.commonEvent' +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; +import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' + +var conn = -1; +function publishCallBackOne () { + console.log("========Publish CallBack AMS_ConnectAbility_0100_commonEvent========"); +} +function publishCallBackTwo () { + console.log("========Publish CallBack AMS_ConnectAbility_0200_commonEvent========"); +} +function publishCallBackThree () { + console.log("========Publish CallBack AMS_ConnectAbility_0300_commonEvent========"); +} +function publishCallBackFour () { + console.log("========Publish CallBack AMS_ConnectAbility_0400_commonEvent========"); +} +function publishCallBackFive () { + console.log("========Publish CallBack AMS_ConnectAbility_0500_commonEvent========"); +} +function publishCallBackSix () { + console.log("========Publish CallBack AMS_ConnectAbility_0600_commonEvent========"); +} +function publishCallBackzero () { + console.log("========Publish CallBack AMSc_disonnectAbility_0100_commonEvent========"); +} +function publishCallBackttwo () { + console.log("========Publish CallBack AMSc_disonnectAbility_0200_commonEvent========"); +} + +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} + +function onConnectCallback(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onConnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onConnect element.abilityName : ' + element.abilityName) +} + +function onDisconnectCallback1(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) +} +function onDisconnectCallback2(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) +} +function onDisconnectCallback3(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) +} +function onDisconnectCallback4(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) +} +function onDisconnectCallback5(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) +} +function onDisconnectCallback6(element) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_ConnectAbility_0100 ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) +} +function onFailedCallback(code) { + console.log('ACTS_ConnectAbility_0100 ConnectAbility onFailed errCode : ' + code) +} + + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + + console.log('ServiceAbility registerApplicationStateObserver begin'); + console.log('ServiceAbility registerApplicationStateObserver end, conn: ' + conn); + } + + onConnect(want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + let extensionContext = this.context + if (want.action == "one") { + commonEvent.publish("AMS_ConnectAbility_0100_commonEvent", publishCallBackOne); + } + ; + if (want.action == "two") { + commonEvent.publish("AMS_ConnectAbility_0200_commonEvent", publishCallBackTwo); + } + ; + if (want.action == "Three") { + commonEvent.publish("AMS_ConnectAbility_0300_commonEvent", publishCallBackThree); + } + ; + if (want.action == "Four") { + commonEvent.publish("AMS_ConnectAbility_0400_commonEvent", publishCallBackFour); + } + ; + if (want.action == "Five") { + commonEvent.publish("AMS_ConnectAbility_0500_commonEvent", publishCallBackFive); + } + ; + if (want.action == "Six") { + commonEvent.publish("AMS_ConnectAbility_0600_commonEvent", publishCallBackSix); + } + ; + if (want.action == "Seven") { + extensionContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility2", + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback1, + onFailed: onFailedCallback, + }, + ); + var myStub4 = new Stub("com.example.actsconnectabilitysystemabilitytest.MainAbility"); + return myStub4; + }; + if (want.action == "Eight") { + extensionContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility3", + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback6, + onFailed: onFailedCallback, + }, + ); + var myStub1 = new Stub("com.example.actsconnectabilitysystemabilitytest.MainAbility"); + return myStub1; + }; + if (want.action == "Nine") { + console.log('connectAbility 111'); + let num = extensionContext.connectAbility( + { + bundleName: 'com.example.actsconnectabilitysystemabilitytest', + abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback2, + onFailed: onFailedCallback, + },) + setTimeout(()=>{ + extensionContext.disconnectAbility(num).then(()=>{ + console.log('in disconnectAbility'); + }) + },1000) + var myStub2 = new Stub("com.example.actsconnectabilitysystemabilitytest.MainAbility"); + return myStub2; + + }; + if (want.action == "Ten") { + console.log('connectAbility 222'); + let num = extensionContext.connectAbility( + { + bundleName: 'com.example.actsconnectabilitysystemabilitytest', + abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback3, + onFailed: onFailedCallback, + },) + setTimeout(()=>{ + extensionContext.disconnectAbility(num).then(()=>{ + console.log('in disconnectAbility2'); + }) + },1000) + var myStub3 = new Stub("com.example.actsconnectabilitysystemabilitytest.MainAbility"); + return myStub3; + + }; + if (want.action == "Ten one") { + console.log('connectAbility 333'); + let num = extensionContext.connectAbility( + { + bundleName: 'com.example.actsconnectabilitysystemabilitytest', + abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback4, + onFailed: onFailedCallback, + },) + setTimeout(()=>{ + extensionContext.disconnectAbility(2222).then(()=>{ + console.log('in disconnectAbility3'); + }) + },1000) + var myStub5 = new Stub("com.example.actsconnectabilitysystemabilitytest.MainAbility"); + return myStub5; + + }; + if (want.action == "Ten two") { + console.log('connectAbility 444'); + let num = extensionContext.connectAbility( + { + bundleName: 'com.example.actsconnectabilitysystemabilitytest', + abilityName: 'com.example.actsconnectabilitysystemabilitytest.ServiceAbility2' + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback5, + onFailed: onFailedCallback, + },) + setTimeout(()=>{ + extensionContext.disconnectAbility(2222).then(()=>{ + console.log('in disconnectAbility4'); + }) + },1000) + var myStub6 = new Stub("com.example.actsconnectabilitysystemabilitytest.MainAbility"); + return myStub6; + + }; + } + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + commonEvent.publish("AMSc_disonnectAbility_0100_commonEvent",publishCallBackzero); + commonEvent.publish("AMSc_disonnectAbility_0200_commonEvent",publishCallBackttwo); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} + diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ebb5e216cd8deddbdaee6c0312790c587da09cd --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonEvent" +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; + +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + } + + onConnect(want: Want) { + console.log('ServiceAbility2 onConnect'); + commonEvent.publish("AMS_ConnectAbility_0700_commonEvent", () => { + console.log("publish Publish AMS_ConnectAbility_0700_commonEvent callback"); + }) + commonEvent.publish("AMS_ConnectAbility_0900_commonEvent", () => { + console.log("publish Publish AMS_ConnectAbility_0900_commonEvent callback"); + }) + commonEvent.publish("AMS_ConnectAbility_1000_commonEvent", () => { + console.log("publish Publish AMS_ConnectAbility_1000_commonEvent callback"); + }) + commonEvent.publish("AMS_ConnectAbility_1100_commonEvent", () => { + console.log("publish Publish AMS_ConnectAbility_1100_commonEvent callback"); + }) + commonEvent.publish("AMS_ConnectAbility_1200_commonEvent", () => { + console.log("publish Publish AMS_ConnectAbility_1200_commonEvent callback"); + }) + return new rpc.RemoteObject('connect'); + } + + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c5de5b34c1ed7e59bd2e0a1505c1d26a173947f9 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ + +@Entry +@Component +struct MyComponent { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World1111111') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5923665570101769b9a6aff451f7c50cc3f6e52 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 abilityTest from './manyusersabilitytest.test.ets' +export default function testsuite(context) { + + abilityTest(context) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5090612999c8d0cd7eb37205f3d3978596a2b075 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets @@ -0,0 +1,814 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' + + +var subscriberInfoStartAbility_0100 = { + events: ["AMS_ConnectAbility_0100_commonEvent"], +}; +var subscriberInfoStartAbility_0200 = { + events: ["AMS_ConnectAbility_0200_commonEvent"], +}; +var subscriberInfoStartAbility_0300 = { + events: ["AMS_ConnectAbility_0300_commonEvent"], +}; +var subscriberInfoStartAbility_0400 = { + events: ["AMS_ConnectAbility_0400_commonEvent"], +}; +var subscriberInfoStartAbility_0500 = { + events: ["AMS_ConnectAbility_0500_commonEvent"], +}; +var subscriberInfoStartAbility_0600 = { + events: ["AMS_ConnectAbility_0600_commonEvent"], +}; +var subscriberInfoStartAbility_0700 = { + events: ["AMS_ConnectAbility_0700_commonEvent"], +}; +var subscriberInfoStartAbility_0800 = { + events: ["AMS_ConnectAbility_0800_commonEvent"], +}; +var subscriberInfoStartAbility_0900 = { + events: ["AMS_ConnectAbility_0900_commonEvent"], +}; + +var subscriberInfoStartAbility_1000 = { + events: ["AMS_ConnectAbility_1000_commonEvent"], +}; + +var subscriberInfoStartAbility_1100 = { + events: ["AMS_ConnectAbility_1100_commonEvent"], +}; + +var subscriberInfoStartAbility_1200 = { + events: ["AMS_ConnectAbility_1200_commonEvent"], +}; +var unsubscriberInfoStartAbility_0100 = { + events: ["AMSc_disonnectAbility_0100_commonEvent"], +}; +var unsubscriberInfoStartAbility_0200 = { + events: ["AMSc_disonnectAbility_0200_commonEvent"], +}; + + +const START_ABILITY_TIMEOUT = 1000; +globalThis.number = 0; + +export default function abilityTest(abilityContext) { + describe('ActssystemabilityTest', function () { + function onFailedCallBack(code) { + console.log('ACTS_ConnectAbility_0200 Connectability errcode:' + code); + } + + /* + * @tc.number: ACTS_ConnectAbility_0100 + * @tc.name: Connects a service ability + * @tc.desc: Connects a service ability + */ + it('ACTS_ConnectAbility_0100', 0, async function (done) { + console.log('ACTS_ConnectAbility_0100====ACTS_ConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); + console.debug("====>ACTS_ConnectAbility_0100 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ConnectAbility_0100 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + + } + + + commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { + console.debug("====>ACTS_ConnectAbility_0100 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('AMS_ConnectAbility_0100 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ConnectAbility_0100 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "one", + }, + ); + console.debug("====>ACTS_ConnectAbility_0100 4 "); + + }) + + /* + * @tc.number: ACTS_ConnectAbility_0200 + * @tc.name: Connects a service ability + * @tc.desc: Connects a service ability + */ + it('ACTS_ConnectAbility_0200', 0, async function (done) { + console.log('ACTS_ConnectAbility_0200====Subscribe CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0200_commonEvent"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + function timeout() { + console.debug('AMS_ConnectAbility_0200 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbilityone", + action: "two", + }, + { + onFailed: onFailedCallBack, + }, + ); + }) + + /* + * @tc.number: ACTS_DisconnectAbility_0100 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_DisconnectAbility_0100', 0, async function (done) { + console.log('ACTS_DisconnectAbility_0100====ACTS_DisconnectAbility_0100 5 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + console.debug("====>ACTS_DisconnectAbility_0100 6====>"); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_DisconnectAbility_0100 6====>"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0300).then(async (data) => { + console.debug("====>ACTS_DisconnectAbility_0100 2 Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + setTimeout(()=> + { + done() + }, 1000)}; + function timeout() { + expect().assertFail(); + console.debug('AMS_DonnectAbility_0300 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_DisconnectAbility_0100 3====>"); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Three", + }, + ); + console.debug("====>ACTS_DisconnectAbility_0100 4====>"); + }) + + /* + * @tc.number: ACTS_DisconnectAbility_0200 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_DisconnectAbility_0200', 0, async function (done) { + console.log('ACTS_DisconnectAbility_0200 1====ACTS_DisconnectAbility_0200 3 CallBack1 data:====>" + JSON.stringify(data)); + commonEvent.createSubscriber(unsubscriberInfoStartAbility_0100).then(async (data) => { + console.debug("====>ACTS_DisconnectAbility_0200 6 Subscriber====>"); + subscriberdisconnect = data; + await commonEvent.subscribe(subscriberdisconnect, subscribedisconnectback); + console.debug("====>ACTS_DisconnectAbility_0200 1111 connectAbility1====>"); + + console.debug("====>ACTS_DisconnectAbility_0200 1111 connectAbility2====>"); + console.debug("====>ACTS_DisconnectAbility_0200 66 Subscriber====>"); + abilityContext.disconnectAbility( + 999, + (error, data) => { + console.log('ACTS_DisconnectAbility_0200 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + }) + } + function subscribedisconnectback(err, data) { + console.debug("====>ACTS_DisconnectAbility_0200 7 CallBack2 data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberdisconnect, () => { + console.debug('unsubscribe subscriberdisconnect'); + commonEvent.unsubscribe(subscriber, () => { + console.debug('unsubscribe subscriber') + clearTimeout(id); + expect().assertFail(); + done(); + }) + }) + } + function timeout() { + console.debug('ACTS_DisconnectAbility_0200 8 timeout'); + commonEvent.unsubscribe(subscriberdisconnect, () => { + console.debug('unsubscribe subscriberdisconnect'); + commonEvent.unsubscribe(subscriber, () => { + console.debug('unsubscribe subscriber') + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('ACTS_DisconnectAbility_0200 9 DisconnectAbility result errCode : ' + error.code + " data: " + data) + console.debug("====>ACTS_DisconnectAbility_0200 99 Subscriber====>"); + setTimeout(() => { + done(); + }, 1000) + }); + }) + }) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0400).then(async (data) => { + console.debug("====>ACTS_DisconnectAbility_0200 10 Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack) + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Four", + }, + ); + console.debug("====>connId is:====>" + JSON.stringify(connId)); + console.debug("====>ACTS_DisconnectAbility_0200 1010 Subscriber====>"); + }) + function unSubscribeCallback() { + console.debug("====>ACTS_DisconnectAbility_0200 1111 UnSubscribe CallBack====>"); + done(); + } + }) + + /* + * @tc.number: ACTS_DisconnectAbility_0300 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_DisconnectAbility_0300', 0, async function (done) { + console.log('ACTS_DisconnectAbility_0300====ACTS_DisconnectAbility_0300 4 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0500_commonEvent"); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('ACTS_DisconnectAbility_0300 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0500).then(async (data) => { + console.debug("====>ACTS_DisconnectAbility_0300 1 Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>ACTS_DisconnectAbility_0300 6 CallBack====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + expect().assertFail(); + console.debug('AMS_ConnectAbility_0500 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('ACTS_DisconnectAbility_0300 7 DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_DisconnectAbility_0300 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Five", + }, + ); + console.debug("====>ACTS_DisconnectAbility_0300 4 "); + }) + + /* + * @tc.number: ACTS_DisconnectAbility_0400 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_DisconnectAbility_0400', 0, async function (done) { + console.log('ACTS_DisconnectAbility_0400 1====ACTS_DisconnectAbility_0400 3 CallBack1 data:====>" + JSON.stringify(data)); + commonEvent.createSubscriber(unsubscriberInfoStartAbility_0200).then(async (data) => { + console.debug("====>ACTS_DisconnectAbility_0400 6 Subscriber====>"); + subscriberdisconnect = data; + await commonEvent.subscribe(subscriberdisconnect, subscribedisconnectback); + console.debug("====>ACTS_DisconnectAbility_0400 1111 connectAbility1====>"); + + console.debug("====>ACTS_DisconnectAbility_0400 1111 connectAbility2====>"); + console.debug("====>ACTS_DisconnectAbility_0400 66 Subscriber====>"); + abilityContext.disconnectAbility( + 999, + (error, data) => { + console.log('ACTS_DisconnectAbility_0400 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + }) + } + function subscribedisconnectback(err, data) { + console.debug("====>ACTS_DisconnectAbility_0400 7 CallBack2 data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberdisconnect, () => { + console.debug('unsubscribe subscriberdisconnect'); + commonEvent.unsubscribe(subscriber, () => { + console.debug('unsubscribe subscriber') + clearTimeout(id); + expect().assertFail(); + done(); + }) + }) + } + function timeout() { + console.debug('ACTS_DisconnectAbility_0400 8 timeout'); + commonEvent.unsubscribe(subscriberdisconnect, () => { + console.debug('unsubscribe subscriberdisconnect'); + commonEvent.unsubscribe(subscriber, () => { + console.debug('unsubscribe subscriber') + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('ACTS_DisconnectAbility_0400 9 DisconnectAbility result errCode : ' + error.code + " data: " + data) + console.debug("====>ACTS_DisconnectAbility_0400 99 Subscriber====>"); + setTimeout(() => { + done(); + }, 1000) + }); + }) + }) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0600).then(async (data) => { + console.debug("====>ACTS_DisconnectAbility_0400 10 Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack) + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Six", + }, + ); + console.debug("====>connId is:====>" + JSON.stringify(connId)); + console.debug("====>ACTS_DisconnectAbility_0400 1010 Subscriber====>"); + }) + function unSubscribeCallback() { + console.debug("====>ACTS_DisconnectAbility_0400 1111 UnSubscribe CallBack====>"); + done(); + } + }) + + /* + * @tc.number: ACTS_ExtensionConnectAbility_0100 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_ExtensionConnectAbility_0100', 0, async function (done) { + console.log('ACTS_ExtensionConnectAbility_0100====ACTS_ExtensionConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0700_commonEvent"); + console.debug("====>ACTS_ExtensionConnectAbility_0100 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionConnectAbility_0100 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0700).then(async (data) => { + console.debug("====>ACTS_ExtensionConnectAbility_0100 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + expect().assertFail(); + console.debug('ACTS_ExtensionConnectAbility_0100 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionConnectAbility_0100 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Seven", + }, + ); + console.debug("====>ACTS_ExtensionConnectAbility_0100 4 "); + }) + + /* + * @tc.number: ACTS_ExtensionConnectAbility_0200 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_ExtensionConnectAbility_0200', 0, async function (done) { + console.log('ACTS_ExtensionConnectAbility_0200====ACTS_ExtensionConnectAbility_0200 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0800_commonEvent"); + console.debug("====>ACTS_ExtensionConnectAbility_0200 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionConnectAbility_0200 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0800).then(async (data) => { + console.debug("====>ACTS_ExtensionConnectAbility_0200 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + console.debug('ACTS_ExtensionConnectAbility_0200 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionConnectAbility_0200 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Eight", + }, + ); + console.debug("====>ACTS_ExtensionConnectAbility_0200 4 "); + }) + + /* + * @tc.number: ACTS_ExtensionDisconnectAbility_0100 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_ExtensionDisconnectAbility_0100', 0, async function (done) { + console.log('ACTS_ExtensionDisconnectAbility_0100====ACTS_ExtensionDisconnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0900_commonEvent"); + console.debug("====>ACTS_ExtensionDisconnectAbility_0100 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0100 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0900).then(async (data) => { + console.debug("====>ACTS_ExtensionDisconnectAbility_0100 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + expect().assertFail(); + console.debug('ACTS_ExtensionDisconnectAbility_0100 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionDisconnectAbility_0100 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Nine", + }, + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0100 4 "); + }) + + /* + * @tc.number: ACTS_ExtensionDisconnectAbility_0200 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_ExtensionDisconnectAbility_0200', 0, async function (done) { + console.log('ACTS_ExtensionDisconnectAbility_0200====ACTS_ExtensionDisconnectAbility_0200 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_1000_commonEvent"); + console.debug("====>ACTS_ExtensionDisconnectAbility_0200 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0200 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_1000).then(async (data) => { + console.debug("====>ACTS_ExtensionDisconnectAbility_0200 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + expect().assertFail(); + console.debug('ACTS_ExtensionDisconnectAbility_0200 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionDisconnectAbility_0200 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Ten", + }, + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0200 4 "); + }) + + /* + * @tc.number: ACTS_ExtensionDisconnectAbility_0300 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_ExtensionDisconnectAbility_0300', 0, async function (done) { + console.log('ACTS_ExtensionDisconnectAbility_0300====ACTS_ExtensionDisconnectAbility_0300 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_1100_commonEvent"); + console.debug("====>ACTS_ExtensionDisconnectAbility_0300 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0300 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_1100).then(async (data) => { + console.debug("====>ACTS_ExtensionDisconnectAbility_0300 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + console.debug('ACTS_ExtensionDisconnectAbility_0300 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionDisconnectAbility_0300 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Ten one", + }, + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0300 4 "); + }) + + /* + * @tc.number: ACTS_ExtensionDisconnectAbility_0400 + * @tc.name: DisConnects a service ability + * @tc.desc: DisConnects a service ability + */ + it('ACTS_ExtensionDisconnectAbility_0400', 0, async function (done) { + console.log('ACTS_ExtensionDisconnectAbility_0400====ACTS_ThirdPartyExtensionDisconnectAbility_0400 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_1200_commonEvent"); + console.debug("====>ACTS_ExtensionDisconnectAbility_0400 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0400 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + commonEvent.createSubscriber(subscriberInfoStartAbility_1200).then(async (data) => { + console.debug("====>ACTS_ExtensionDisconnectAbility_0400 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + function timeout() { + console.debug('ACTS_ExtensionDisconnectAbility_0400 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionDisconnectAbility_0400 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsconnectabilitysystemabilitytest", + abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + action: "Ten two", + }, + ); + console.debug("====>ACTS_ExtensionDisconnectAbility_0400 4 "); + }) + }) +} + + diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/module.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..cf31417fde889f687cecc5ab74df3202b33a80a0 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/module.json @@ -0,0 +1,108 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsconnectabilitysystemabilitytest.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsconnectabilitysystemabilitytest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "reason": "ceshi" + }, + { + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", + "reason": "ceshi" + }, + { + "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/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/app.json b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7df200e766149905fe00e1c52ef302b29c4bdfe1 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsextensionconnectabilitytest", + "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/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/BUILD.gn b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/BUILD.gn rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/BUILD.gn diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/Test.json b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..71a06299005d6470db0803a144526723674ab829 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/Test.json @@ -0,0 +1,42 @@ + +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "120000", + "package": "com.example.actsextensionconnectabilitytest", + "shell-timeout": "60000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm switch -i 101" + ], + "teardown-command":[ + "acm delete -i 101" + ] + }, + { + "test-file-name": [ + "ActsExtensionConnectAbilityTest.hap", + "actsServiceAbilityRelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "actsServiceAbilityRelyHap.hap->/data/app/actsServiceAbilityRelyHap.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/app/*.hap" + ] + } + ] +} + diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0bf6d03c42692b93d73f346b44f441fe485ee2d --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,25 @@ +/* + * 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.stageOnCreateRun = 1; + globalThis.startnum = 0 + globalThis.stageContext = this.context; + + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ce4bf5e8d26503167a29a3e55e9efe5d79293b2 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,55 @@ +/* + * 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("AbilityMultiInstanceTest onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("AbilityMultiInstanceTest onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("AbilityMultiInstanceTest onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("AbilityMultiInstanceTest onWindowStageDestroy") + } + + + onForeground() { + // Ability has brought to foreground + console.log("AbilityMultiInstanceTest onForeground") + } + + onBackground() { + // Ability has back to background + console.log("AbilityMultiInstanceTest onBackground") +} + +}; diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb5e063866f2e4951c81a0c765d23c6a22ef2c1d --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,81 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from '@ohos.commonEvent' +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; +function publishCallBackOne () { + console.log("========Publish CallBack AMS_ConnectAbility_0300_commonEvent========"); +} +function onConnectCallback(element) { + console.log('connectAbilityWithAccount onConnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onConnect element.abilityName : ' + element.abilityName) +} + +function onDisconnectCallback(element) { + console.log('connectAbilityWithAccount onDisconnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onDisconnect element.abilityName : ' + element.abilityName) +} + +function onFailedCallback(code) { + console.log('connectAbilityWithAccount onFailed errCode : ' + code) +} +var conn = -1; +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + + console.log('ServiceAbility registerApplicationStateObserver begin'); + console.log('ServiceAbility registerApplicationStateObserver end, conn: ' + conn); + } + + onConnect(want: Want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + let extensionContext = this.context + if (want.action == "Three") { + console.log('connectAbility 111'); + let num = extensionContext.connectAbility( + { + bundleName: 'com.example.actsserviceabilityrelytest', + abilityName: 'com.example.actsserviceabilityrelytest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + },) + setTimeout(()=>{ + extensionContext.disconnectAbility(num).then(()=>{ + console.log('in disconnectAbility'); + }) + },1000) + + }; + commonEvent.publish("AMS_ConnectAbility_0300_commonEvent", publishCallBackOne); + return new rpc.RemoteObject('connect'); + }; + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} + diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf2d6c33446d2bf0a236f8d80c5e2f9740930598 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,77 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from '@ohos.commonEvent' +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; +function publishCallBackOne () { + console.log("========Publish CallBack AMS_ConnectAbility_0400_commonEvent========"); +} +var conn = -1; +function onConnectCallback(element) { + console.log('connectAbilityWithAccount onConnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onConnect element.abilityName : ' + element.abilityName) +} +function onDisconnectCallback(element) { + console.log('connectAbilityWithAccount onDisconnect element.bundleName : ' + element.bundleName) + console.log('connectAbilityWithAccount onDisconnect element.abilityName : ' + element.abilityName) +} +function onFailedCallback(code) { + console.log('connectAbilityWithAccount onFailed errCode : ' + code) +} +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + + console.log('ServiceAbility registerApplicationStateObserver begin'); + console.log('ServiceAbility registerApplicationStateObserver end, conn: ' + conn); + } + + onConnect(want: Want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + let extensionContext = this.context + + console.log('connectAbility 222'); + let num = extensionContext.connectAbility( + { + bundleName: 'com.example.actsserviceabilityrelytest', + abilityName: 'com.example.actsserviceabilityrelytest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + },) + setTimeout(()=>{ + extensionContext.disconnectAbility(num).then(()=>{ + console.log('in disconnectAbility2'); + }) + },1000) + commonEvent.publish("AMS_ConnectAbility_0400_commonEvent", publishCallBackOne); + return new rpc.RemoteObject('connect'); + }; + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} + diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ae20139168905bbf3e17e026acc49b41d5935fa --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,52 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World1111111') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..755f04974d20a72df6db6b3a0e7dc08ca08c6abd --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 abilityTest from './actsextensionconnectabilitytest.test.ets' +export default function testsuite(context) { + + abilityTest(context) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/actsextensionconnectabilitytest.test.ets b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/actsextensionconnectabilitytest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..756d950995a805eecab0370001b051e9e92f6de2 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/ets/test/actsextensionconnectabilitytest.test.ets @@ -0,0 +1,291 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' + + +var subscriberInfoStartAbility_0100 = { + events: ["AMS_ConnectAbility_0100_commonEvent"], +}; +var subscriberInfoStartAbility_0200 = { + events: ["AMS_ConnectAbility_0200_commonEvent"], +}; +var subscriberInfoStartAbility_0300 = { + events: ["AMS_ConnectAbility_0300_commonEvent"], +}; +var subscriberInfoStartAbility_0400 = { + events: ["AMS_ConnectAbility_0400_commonEvent"], +}; +const START_ABILITY_TIMEOUT = 5000; +globalThis.number = 0; + +export default function abilityTest(abilityContext) { + describe('ActsExtensionConnectAbilityTest', function () { + + it('ACTS_ConnectAbility_0300', 0, async function (done) { + console.log('ACTS_ConnectAbility_0300====ACTS_ConnectAbility_0300 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); + console.debug("====>ACTS_ConnectAbility_0300 5 "); + abilityContext.disconnectAbility( + connId, + (err, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) + } + ); + console.debug("====>ACTS_ConnectAbility_0300 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + + } + + + commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { + console.debug("====>ACTS_ConnectAbility_0300 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack) + connId = await abilityContext.connectAbility({ + bundleName: "com.example.actsserviceabilityrelytest", + abilityName: "com.example.actsserviceabilityrelytest.ServiceAbility", + }, (err, data) => { + console.log('ACTS_ProcessManage SystemAppA onShowProcess startAbility startServiceAbility: ' + + JSON.stringify(err) + ", " + JSON.stringify(data)) + }) + }) + + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_ConnectAbility_0300 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (err, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) + }); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ConnectAbility_0300 4 "); + + }) + + it('ACTS_ConnectAbility_0400', 0, async function (done) { + console.log('ACTS_ConnectAbility_0400====ACTS_ConnectAbility_0400 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0200_commonEvent"); + console.debug("====>ACTS_ConnectAbility_0400 5 "); + abilityContext.disconnectAbility( + connId, + (err, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) + } + ); + console.debug("====>ACTS_ConnectAbility_0400 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + + } + + + commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { + console.debug("====>ACTS_ConnectAbility_0400 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + console.debug("====>ACTS_ConnectAbility_0400 3 "); + connId = await abilityContext.connectAbility({ + bundleName: "com.example.actsserviceabilityrelytest", + abilityName: "com.example.actsserviceabilityrelytest.ServiceAbility", + }, (err, data) => { + console.log('ACTS_ProcessManage SystemAppA onShowProcess startAbility startServiceAbility: ' + + JSON.stringify(err) + ", " + JSON.stringify(data)) + }) + console.debug("====>ACTS_ConnectAbility_0400 4 "); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_ConnectAbility_0400 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (err, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + err.code + " data: " + data) + }); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + + }) + + it('ACTS_ExtensionConnectAbility_0300', 0, async function (done) { + console.log('ACTS_ExtensionConnectAbility_0300====ACTS_ExtensionConnectAbility_0300 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0300_commonEvent"); + console.debug("====>ACTS_ExtensionConnectAbility_0300 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionConnectAbility_0300 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + + } + + + commonEvent.createSubscriber(subscriberInfoStartAbility_0300).then(async (data) => { + console.debug("====>ACTS_ExtensionConnectAbility_0300 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsextensionconnectabilitytest", + abilityName: "com.example.actsextensionconnectabilitytest.ServiceAbility", + action:"Three", + }).then(()=>{ + console.debug("====>startAbility end====>"); + }) + console.debug("====>ACTS_ExtensionConnectAbility_0300 4 "); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_ExtensionConnectAbility_0300 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>ACTS_ExtensionConnectAbility_0300 3 "); + + }) + + it('ACTS_ExtensionConnectAbility_0400', 0, async function (done) { + console.log('ACTS_ExtensionConnectAbility_0400====ACTS_ExtensionConnectAbility_0400 7 CallBack data:====>" + JSON.stringify(data)); + clearTimeout(id); + expect(data.event).assertEqual("AMS_ConnectAbility_0400_commonEvent"); + console.debug("====>ACTS_ExtensionConnectAbility_0400 5 "); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + } + ); + console.debug("====>ACTS_ExtensionConnectAbility_0400 6 "); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + + } + + + commonEvent.createSubscriber(subscriberInfoStartAbility_0400).then(async (data) => { + console.debug("====>ACTS_ExtensionConnectAbility_0400 2 Subscriber1====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + console.debug("====>ACTS_ExtensionConnectAbility_0400 3 "); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.actsextensionconnectabilitytest", + abilityName: "com.example.actsextensionconnectabilitytest.ServiceAbility2", + action:"Four", + }, + ); + console.debug("====>ACTS_ExtensionConnectAbility_0400 4 "); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack1====>"); + setTimeout(() => { + done(); + }, 1000) + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_ExtensionConnectAbility_0400 timeout'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + + }) + + + + }) +} + + diff --git a/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/module.json b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..c67df1310741ea21e1dfd1e0d7ff80f0cdd11ed7 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/module.json @@ -0,0 +1,100 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsextensionconnectabilitytest.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsextensionconnectabilitytest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsextensionconnectabilitytest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/actsextensionconnectabilitytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/actsextensionconnectabilitytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/AppScope/app.json b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/AppScope/app.json rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/AppScope/app.json diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsusers/actsserviceabilityrelytest/BUILD.gn b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2c0778690c6b7daa670896025cc89425d8361ffb --- /dev/null +++ b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/BUILD.gn @@ -0,0 +1,44 @@ +# 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("actsServiceAbilityRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "actsServiceAbilityRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsserviceabilityrelytest_js_assets", + ":actsserviceabilityrelytest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsserviceabilityrelytest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsserviceabilityrelytest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsserviceabilityrelytest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsserviceabilityrelytest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/Test.json b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/Test.json rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/Test.json diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..62a126278e7f96180c50dd09154e882fb107bbb1 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,50 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from '@ohos.commonEvent' +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; +function publishCallBackOne () { + console.log("========Publish CallBack AMS_ConnectAbility_0100_commonEvent========"); +} +function publishCallBackTwo () { + console.log("========Publish CallBack AMS_ConnectAbility_0200_commonEvent========"); +} + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + } + + onConnect(want: Want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + commonEvent.publish("AMS_ConnectAbility_0100_commonEvent", publishCallBackOne); + commonEvent.publish("AMS_ConnectAbility_0200_commonEvent", publishCallBackTwo); + return new rpc.RemoteObject('connect'); + }; + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} + diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3decc40b0d4eb50669faaf4eae22ef13156b4a4e --- /dev/null +++ b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/module.json b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/module.json rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/actsserviceabilityrelytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsserviceabilityrelytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsusers/actsserviceabilityrelytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/BUILD.gn rename to ability/ability_runtime/amscontextualinforquery/BUILD.gn diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c3e2fb7737f55fa80f3fd5727de64af966042833 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.extensionmodule", + "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/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9ca60e9bc801edec2f1a60b5f316630d3d89de12 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsExtensionModuleRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsExtensionModuleRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsextensionmodulerelyhap_js_assets", + ":actsamsextensionmodulerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsextensionmodulerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsextensionmodulerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsextensionmodulerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsextensionmodulerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..24066f46ce7b42fa80023a5fd651914a8493465b --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,99 @@ +/* + * 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' +import rpc from '@ohos.rpc' + +var connection = -1; +let options = { + onConnect: function(elementName, proxy) { + console.log("mxh onConnect success"); + if (proxy == null) { + console.log("mxh proxy == null"); + return; + } + let option = new rpc.MessageOption(); + let data = new rpc.MessageParcel(); + let reply = new rpc.MessageParcel(); + data.writeInt(1); + data.writeInt(99); + proxy.sendRequest(1, data, reply, option); + let msg = reply.readInt(); + console.log("mxh onConnect msg:" + msg); + }, + + onDisconnect: function() {console.log("mxh onDisconnect success");}, + onFailed: function() {console.log("mxh onFailed");} +} +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('mxh MainAbility onCreate is called' + want + launchParam); + } + + onDestroy() { + console.log('mxh MainAbility onDestroy is called'); + } + + onWindowStageCreate(windowStage) { + console.log('mxh MainAbility onWindowStageCreate is called'); + let context = this.context; + globalThis.startServiceExtAbility = (() => { + console.log("mxh startServiceExtAbility begin"); + var want = { + "bundleName": "com.example.ohosproject.hmservice", + "abilityName": "ServiceExtAbility", + } + context.startAbility(want).then((data) => { + console.info("mxh startAbility success:" + JSON.stringify(data)); + }).catch((error) => { + console.error("mxh startAbility failed:" + JSON.stringify(error)); + }) + console.log("mxh startServiceExtAbility end"); + }) + + globalThis.connectServiceExtAbility = (() => { + console.log("mxh connectServiceExtAbility begin"); + var want = { + "bundleName": "com.example.ohosproject.hmservice", + "abilityName": "ServiceExtAbility", + } + connection = context.connectAbility(want, options); + console.log("mxh connectServiceExtAbility end, connection:" + connection); + }) + + globalThis.disconnectServiceExtAbility = (() => { + console.log("mxh disconnectServiceExtAbility begin"); + context.disconnectAbility(connection).then((data) => { + console.info("mxh startAbility success:" + JSON.stringify(data)); + }).catch((error) => { + console.error("mxh startAbility failed:" + JSON.stringify(error)); + }); + console.log("mxh disconnectServiceExtAbility end, connection:" + connection); + }) + + windowStage.setUIContent(this.context, 'pages/index/index', null); + } + + onWindowStageDestroy() { + console.log('mxh MainAbility onWindowStageDestroy is called'); + } + + onForeground() { + console.log('mxh MainAbility onForeground is called'); + } + + onBackground() { + console.log('mxh MainAbility onBackground is called'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f766470d826a698e436ad1db2789105190177165 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,50 @@ +/* + * 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 Extension from '@ohos.application.ServiceExtensionAbility' +import commonEvent from '@ohos.commonEvent' +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; + +export default class ServiceExtAbility extends Extension { + onCreate(want) { + console.info('mxh ServiceAbility onCreate**'); + + } + + onRequest(want, startId) { + console.info('mxh ServiceAbility onRequest**'); + } + + onConnect(want:Want) { + console.info('mxh ServiceAbility onConnect**'); + commonEvent.publish("ACTS_ConnectAbility_0100_CommonEvent", { + parameters: { + extensionAbilityInfo : JSON.stringify(this.context.extensionAbilityInfo), + } + } ,(err) => { + console.log("Demo Publish CallBack MainAbility_Start_CommonEvent") + }); + console.log('Demo SerivceAbilityServer OnConnect start 1'); + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.info('mxh ServiceAbility onDisConnect**'); + } + + onDestroy() { + console.info('mxh ServiceAbility onDestroy**'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/service.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/ServiceAbility/service.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/index/index.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..5688c398db78ea3bb5d87d96a86246331f88710d --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json @@ -0,0 +1,100 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.pmvendorappservice.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": [ + { + "name": "ServiceExtAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "permissions": [ + "ohos.permission.USE_BLUETOOTH" + ], + "metadata": [ + { + "name": "ohos.extension.form", + "value": "MainAbility", + "resource": "@profile:form_config" + } + ], + "visible": true, + "type": "service" + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/actsusers/actsextensionconnectabilitytest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/profile/main_pages.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/app.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/BUILD.gn rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/BUILD.gn diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/Test.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/Test.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0dbbdefd3a259f4feb2a4313e790b9b18fdad4a --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityStageContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticabilitystagecontexttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8ee1b11aa5ce62aaf99ab3786306fa3c8c5aa692 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.staticextensioninfotest", + "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/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..faf67aba57e21e7a1ebcc8b13ea8f61911bbfb76 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsStaticExtensionInfoRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsStaticExtensionInfoRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsstaticextensioninforelyhap_js_assets", + ":actsamsstaticextensioninforelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsstaticextensioninforelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsstaticextensioninforelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsstaticextensioninforelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsstaticextensioninforelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0f8dec8b9d550b91d666f453c623f929a1992cb --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* +* 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("ACTS_ProcessManage VendorAppService MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_ProcessManage VendorAppService MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageDestroy") + } + + async onForeground() { + // Ability has brought to foreground + console.log("ACTS_ProcessManage VendorAppService MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("ACTS_ProcessManage VendorAppService MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6876adc087186b2b0eb256f586eadbb2227df7d --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,57 @@ +/* + * 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonEvent"; +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; + +export default class ServiceAbility extends ServiceExtension { + onCreate(want:Want) { + globalThis.abilityWant = want; + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + } + + onConnect(want) { + console.log('ServiceAbility2 onConnect, abilityName:' + want.abilityName); + console.log('ServiceAbility2 onConnect, action:' + want.action); + globalThis.extensionContext = this.context + if (want.action == 'getExtensionInfoTest') { + commonEvent.publish("ACTS_ConnectAbility_0200_CommonEvent", { + parameters: { + hapModuleInfo2: JSON.stringify(this.context.currentHapModuleInfo), + applicationInfo2: JSON.stringify(this.context.applicationInfo) + } + } ,(err) => { + console.log("MainAbility Publish CallBack MainAbility_Start_CommonEvent") + }); + console.log('stub SerivceAbilityServer OnConnect start 2'); + + } + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/service.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/ServiceAbility/service.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/index/index.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7c9e5a72882896bf2acf1f64e4b74208a16b4b45 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json @@ -0,0 +1,90 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.staticextensioninfotest.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.staticextensioninfotest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + } + ] + } +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/app.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/BUILD.gn rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/BUILD.gn diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/Test.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/Test.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f19229ef18a8c1cb828c40cd6fbe126f597475c --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,56 @@ +/* + * 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonEvent"; +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; + +export default class ServiceAbility extends ServiceExtension { + onCreate(want:Want) { + globalThis.abilityWant = want; + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + console.log('ServiceAbility registerApplicationStateObserver begin'); + } + + onConnect(want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + globalThis.extensionContext = this.context + if (want.action == 'getExtensionInfo') { + commonEvent.publish("ACTS_ConnectAbility_0100_CommonEvent", { + parameters: { + hapModuleInfo: JSON.stringify(this.context.currentHapModuleInfo), + applicationInfo: JSON.stringify(this.context.applicationInfo), + } + } ,(err) => { + console.log("MainAbility Publish CallBack MainAbility_Start_CommonEvent") + }); + console.log('stub SerivceAbilityServer OnConnect start 1'); + } + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/service.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ad0e8ab7504c47cb7ffc46f6041c9c25b6e8b75 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,471 @@ +/* + * 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 commonEvent from "@ohos.commonEvent" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const START_ABILITY_TIMEOUT = 5000; +var subscriberInfoStartAbility_0100 = { + events: ["ACTS_ConnectAbility_0100_CommonEvent"], +}; +var subscriberInfoStartAbility_0200 = { + events: ["ACTS_ConnectAbility_0200_CommonEvent"], +}; + +export default function abilityTest(abilityContext) { + + describe('ActsExtensionAbilityTest', function () { + + /* + * @tc.number: ACTS_getExtensionInfo_0100 + * @tc.name: Start the system permission application to query static information about Extension + * @tc.desc: Enable application ras to query the Extension static information. Verify the query information. + Enable application ras to connect to serviceAbility + */ + it('ACTS_getExtensionInfo_0100', 0, async function (done) { + console.log('ACTS_getExtensionInfo_0100 gyq ====ACTS_getExtensionInfo_0100_Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_ConnectAbility_0100_CommonEvent") { + clearTimeout(id); + checkHapModuleInfo(JSON.parse(data.parameters['hapModuleInfo'])) + checkApplicationInfo(JSON.parse(data.parameters['applicationInfo'])) + expect(data.event).assertEqual("ACTS_ConnectAbility_0100_CommonEvent"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { + console.debug("====>ACTS_getExtensionInfo_0100_Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.staticextensioninfo", + abilityName: "com.example.staticextensioninfo.ServiceAbility", + action: "getExtensionInfo" + } + ); + console.log('ACTS_getExtensionInfo_0100 ConnectAbility connId : ' + connId); + }) + + function unSubscribeCallback() { + console.debug("====>ACTS_getExtensionInfo_0100_UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_ConnectAbility_0100 timeout'); + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + + + function checkHapModuleInfo(data) { + console.log("checkHapModuleInfo start " + data); + console.log("checkHapModuleInfo name : " + data.name); + console.log("checkHapModuleInfo description : " + data.description); + console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); + console.log("checkHapModuleInfo icon : " + data.icon); + console.log("checkHapModuleInfo label : " + data.label); + console.log("checkHapModuleInfo labelId : " + data.labelId); + console.log("checkHapModuleInfo iconId : " + data.iconId); + console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg); + console.log("checkHapModuleInfo supportedModes : " + data.supportedModes); + console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); + for (var j = 0; j < data.reqCapabilities.length; j++) { + console.log("checkHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); + } + console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); + for (var j = 0; j < data.deviceTypes.length; j++) { + console.log("checkHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); + } + console.log("checkHapModuleInfo moduleName : " + data.moduleName); + console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); + console.log("checkHapModuleInfo installationFree : " + data.installationFree); + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.backgroundImg)).assertEqual("string"); + expect(typeof (data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.reqCapabilities)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.abilityInfo)).assertEqual(true); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.mainAbilityName)).assertEqual("string"); + console.log("checkHapModuleInfo_expect_typeof_end") + expect(data.name).assertEqual("phone"); + expect(data.description).assertEqual("$string:phone_entry_dsc"); + expect(data.descriptionId).assertEqual(undefined); + expect(data.icon).assertEqual("$media:icon"); + expect(data.label).assertEqual("$string:entry_label"); + expect(data.labelId).assertEqual(undefined); + expect(data.iconId).assertEqual(undefined); + expect(data.backgroundImg).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + expect(data.reqCapabilities.length).assertEqual(0); + expect(data.reqCapabilities[0]).assertEqual(undefined); + expect(data.deviceTypes.length).assertEqual(1); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.moduleName).assertEqual("phone") + expect(data.mainAbilityName).assertEqual("MainAbility"); + expect(data.installationFree).assertEqual(undefined); + console.log("checkHapModuleInfo end " + data); + } + function checkApplicationInfo(data) { + console.log("checkApplicationInfo start " + data); + console.log("checkApplicationInfo name : " + data.name); + console.log("checkApplicationInfo description : " + data.description); + console.log("checkApplicationInfo descriptionId : " + data.descriptionId); + console.log("checkApplicationInfo systemApp : " + data.systemApp); + console.log("checkApplicationInfo enabled : " + data.enabled); + console.log("checkApplicationInfo label : " + data.label) + console.log("checkApplicationInfo labelId : " + data.labelId); + console.log("checkApplicationInfo icon : " + data.icon); + console.log("checkApplicationInfo iconId : " + data.iconId); + console.log("checkApplicationInfo process : " + data.process); + console.log("checkApplicationInfo supportedModes : " + data.supportedModes); + console.log("checkApplicationInfo moduleSourceDirs length : " + data.moduleSourceDirs.length); + for (var j = 0; j < data.moduleSourceDirs.length; j++) { + console.log("checkApplicationInfo data.moduleSourceDirs[" + j + "] : " + data.moduleSourceDirs[j]); + } + console.log("checkApplicationInfo permissions length : " + data.permissions.length); + for (var j = 0; j < data.permissions.length; j++) { + console.log("checkApplicationInfo data.permissions[" + j + "] : " + data.permissions[j]); + } + console.log("checkApplicationInfo moduleInfos length : " + data.moduleInfos.length); + for (var j = 0; j < data.moduleInfos.length; j++) { + console.log("checkApplicationInfo data.moduleInfos[" + j + "].moduleName : " + data.moduleInfos[j].moduleName); + console.log("checkApplicationInfo data.moduleInfos[" + j + "].moduleSourceDir:" + + data.moduleInfos[j].moduleSourceDir); + } + console.log("checkApplicationInfo entryDir : " + data.entryDir); + console.log("checkApplicationInfo codePath : " + data.codePath); + console.log("checkApplicationInfo removable: " + data.removable); + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.systemApp)).assertEqual("boolean"); + expect(typeof (data.enabled)).assertEqual("boolean"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.iconId)).assertEqual("string"); + expect(typeof (data.process)).assertEqual("string"); + expect(typeof (data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true); + expect(Array.isArray(data.permissions)).assertEqual(true); + expect(Array.isArray(data.moduleInfos)).assertEqual(true); + expect(typeof (data.entryDir)).assertEqual("string"); + expect(typeof (data.codePath)).assertEqual("string"); + expect(typeof (data.removable)).assertEqual("boolean"); + console.log("checkApplicationInfo_expect_typeof_end") + expect(data.name).assertEqual("com.example.staticextensioninfo"); + expect(data.description).assertEqual("$string:description_application"); + expect(data.descriptionId).assertLarger(0); + expect(data.systemApp).assertEqual(true); + expect(data.enabled).assertEqual(true); + expect(data.label).assertEqual("$string:app_name"); + expect(data.labelId).assertEqual("16777216"); + expect(data.icon).assertEqual(""); + expect(data.iconId).assertEqual("16777224"); + expect(data.process).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + expect(data.moduleSourceDirs.length).assertEqual(1); + expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + + "com.example.staticextensioninfo/phone"); + expect(data.moduleInfos.length).assertEqual(1); + expect(data.moduleInfos[0].moduleName).assertEqual("phone"); + expect(data.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.example.staticextensioninfo/phone"); + expect(data.entryDir).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfo" + + "/phone"); + expect(data.codePath).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfo"); + expect(data.removable).assertEqual(true); + console.log("checkApplicationInfo end " + data); + } + }) + + /* + * @tc.number: ACTS_getExtensionInfo_0200 + * @tc.name: Apply StaticExtensionInfo. Connect to StaticExtensionInfoTest to query static information + about an Extension + * @tc.desc: Enabling an application to connect to StaticExtensionInfo. Connecting to StaticExtensionInfoTest + To query static information about an Extension. Verifying the query information + */ + it('ACTS_getExtensionInfo_0200', 0, async function (done) { + console.log('ACTS_getExtensionInfo_0200====ACTS_getExtensionInfo_0200_Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_ConnectAbility_0200_CommonEvent") { + clearTimeout(id); + checkHapModuleInfo_0200(JSON.parse(data.parameters['hapModuleInfo2'])) + checkApplicationInfo_0200(JSON.parse(data.parameters['applicationInfo2'])) + expect(data.event).assertEqual("ACTS_ConnectAbility_0200_CommonEvent"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { + console.debug("====>ACTS_getExtensionInfo_0200_Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.staticextensioninfotest", + abilityName: "com.example.staticextensioninfotest.ServiceAbility", + action: "getExtensionInfoTest" + } + ); + console.log('ACTS_getExtensionInfo_0200 ConnectAbility connId : ' + connId); + }) + + function unSubscribeCallback() { + console.debug("====>ACTS_getExtensionInfo_0200_UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_ConnectAbility_0200 timeout'); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + + + function checkHapModuleInfo_0200(data) { + console.log("checkHapModuleInfo2 start " + data); + console.log("checkHapModuleInfo2 name : " + data.name); + console.log("checkHapModuleInfo2 description : " + data.description); + console.log("checkHapModuleInfo2 descriptionId : " + data.descriptionId); + console.log("checkHapModuleInfo2 icon : " + data.icon); + console.log("checkHapModuleInfo2 label : " + data.label); + console.log("checkHapModuleInfo2 labelId : " + data.labelId); + console.log("checkHapModuleInfo2 iconId : " + data.iconId); + console.log("checkHapModuleInfo2 backgroundImg : " + data.backgroundImg); + console.log("checkHapModuleInfo2 supportedModes : " + data.supportedModes); + console.log("checkHapModuleInfo2 reqCapabilities length : " + data.reqCapabilities.length); + for (var j = 0; j < data.reqCapabilities.length; j++) { + console.log("checkHapModuleInfo2 data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); + } + console.log("checkHapModuleInfo2 deviceTypes length : " + data.deviceTypes.length); + for (var j = 0; j < data.deviceTypes.length; j++) { + console.log("checkHapModuleInfo2 data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); + } + console.log("checkHapModuleInfo2 moduleName : " + data.moduleName); + console.log("checkHapModuleInfo2 mainAbilityName : " + data.mainAbilityName); + console.log("checkHapModuleInfo2 installationFree : " + data.installationFree); + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.backgroundImg)).assertEqual("string"); + expect(typeof (data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.reqCapabilities)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.abilityInfo)).assertEqual(true); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.mainAbilityName)).assertEqual("string"); + console.log("checkHapModuleInfo_expect_typeof_end") + expect(data.name).assertEqual("phone"); + expect(data.description).assertEqual("$string:phone_entry_dsc"); + expect(data.descriptionId).assertEqual(undefined); + expect(data.icon).assertEqual("$media:icon"); + expect(data.label).assertEqual("$string:entry_label"); + expect(data.labelId).assertEqual(undefined); + expect(data.iconId).assertEqual(undefined); + expect(data.backgroundImg).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + expect(data.reqCapabilities.length).assertEqual(0); + expect(data.reqCapabilities[0]).assertEqual(undefined); + expect(data.deviceTypes.length).assertEqual(1); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.moduleName).assertEqual("phone") + expect(data.mainAbilityName).assertEqual("MainAbility"); + expect(data.installationFree).assertEqual(undefined); + console.log("checkHapModuleInfo end " + data); + } + function checkApplicationInfo_0200(data) { + console.log("checkApplicationInfo2 start " + data); + console.log("checkApplicationInfo2 name : " + data.name); + console.log("checkApplicationInfo2 description : " + data.description); + console.log("checkApplicationInfo2 descriptionId : " + data.descriptionId); + console.log("checkApplicationInfo2 systemApp : " + data.systemApp); + console.log("checkApplicationInfo2 enabled : " + data.enabled); + console.log("checkApplicationInfo2 label : " + data.label) + console.log("checkApplicationInfo2 labelId : " + data.labelId); + console.log("checkApplicationInfo2 icon : " + data.icon); + console.log("checkApplicationInfo2 iconId : " + data.iconId); + console.log("checkApplicationInfo2 process : " + data.process); + console.log("checkApplicationInfo2 supportedModes : " + data.supportedModes); + console.log("checkApplicationInfo2 moduleSourceDirs length : " + data.moduleSourceDirs.length); + for (var j = 0; j < data.moduleSourceDirs.length; j++) { + console.log("checkApplicationInfo2 data.moduleSourceDirs[" + j + "] : " + data.moduleSourceDirs[j]); + } + console.log("checkApplicationInfo2 permissions length : " + data.permissions.length); + for (var j = 0; j < data.permissions.length; j++) { + console.log("checkApplicationInfo2 data.permissions[" + j + "] : " + data.permissions[j]); + } + console.log("checkApplicationInfo2 moduleInfos length : " + data.moduleInfos.length); + for (var j = 0; j < data.moduleInfos.length; j++) { + console.log("checkApplicationInfo2 data.moduleInfos[" + j + "].moduleName : " + data.moduleInfos[j].moduleName); + console.log("checkApplicationInfo2 data.moduleInfos[" + j + "].moduleSourceDir:" + + data.moduleInfos[j].moduleSourceDir); + } + console.log("checkApplicationInfo2 entryDir : " + data.entryDir); + console.log("checkApplicationInfo2 codePath : " + data.codePath); + console.log("checkApplicationInfo2 removable: " + data.removable); + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.systemApp)).assertEqual("boolean"); + expect(typeof (data.enabled)).assertEqual("boolean"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.iconId)).assertEqual("string"); + expect(typeof (data.process)).assertEqual("string"); + expect(typeof (data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true); + expect(Array.isArray(data.permissions)).assertEqual(true); + expect(Array.isArray(data.moduleInfos)).assertEqual(true); + expect(typeof (data.entryDir)).assertEqual("string"); + expect(typeof (data.codePath)).assertEqual("string"); + expect(typeof (data.removable)).assertEqual("boolean"); + console.log("checkApplicationInfo_expect_typeof_end") + expect(data.name).assertEqual("com.example.staticextensioninfotest"); + expect(data.description).assertEqual("$string:description_application"); + expect(data.descriptionId).assertLarger(0); + expect(data.systemApp).assertEqual(true); + expect(data.enabled).assertEqual(true); + expect(data.label).assertEqual("$string:app_name"); + expect(data.labelId.length).assertLarger(0); + expect(data.icon).assertEqual(""); + expect(data.iconId.length).assertLarger(0); + expect(data.process).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + expect(data.moduleSourceDirs.length).assertEqual(1); + expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + + "com.example.staticextensioninfotest/phone"); + expect(data.moduleInfos.length).assertEqual(1); + expect(data.moduleInfos[0].moduleName).assertEqual("phone"); + expect(data.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.example.staticextensioninfotest/phone"); + expect(data.entryDir).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfotest" + + "/phone"); + expect(data.codePath).assertEqual("/data/app/el1/bundle/public/com.example.staticextensioninfotest"); + expect(data.removable).assertEqual(true); + console.log("checkApplicationInfo end " + data); + } + }) + + /* + * @tc.number: ACTS_getExtensionInfo_0300 + * @tc.name: Apply StaticExtensionInfo. Connect to StaticExtensionInfoTest to query static information + about an Extension + * @tc.desc: Verify configuration module.json connect service application query property information + */ + it('ACTS_getExtensionInfo_0300', 0, async function (done) { + console.log('ACTS_getExtensionInfo_0300====ACTS_getExtensionInfo_0300_Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_ConnectAbility_0100_CommonEvent") { + clearTimeout(id); + checkExtensionAbilityInfo(JSON.parse(data.parameters['extensionAbilityInfo'])) + expect(data.event).assertEqual("ACTS_ConnectAbility_0100_CommonEvent"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + } + commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { + console.debug("====>ACTS_getExtensionInfo_0300_Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + connId = await abilityContext.connectAbility( + { + bundleName: "com.example.extensionmodule", + abilityName: "ServiceExtAbility", + } + ); + console.log('ACTS_getExtensionInfo_0300 ConnectAbility connId : ' + connId); + }) + + function unSubscribeCallback() { + console.debug("====>ACTS_getExtensionInfo_0300_UnSubscribe CallBack====>"); + } + + function timeout() { + expect().assertFail(); + abilityContext.disconnectAbility( + connId, + (error, data) => { + console.log('DisconnectAbility_0300 result errCode : ' + error.code + " data: " + data) + done(); + }, + ); + console.debug('ACTS_ConnectAbility_0300 timeout'); + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + + + function checkExtensionAbilityInfo(data) { + console.log("checkHapModuleInfo_expect_typeof_end3") + console.log("checkAbilityInfo metadata length : " + data.metadata.length); + console.log("checkAbilityInfo metadata length : " + data.metadata[0].name); + expect(data.metadata[0].name).assertEqual("ohos.extension.form"); + expect(data.metadata[0].value).assertEqual("MainAbility"); + expect(data.metadata[0].resource).assertEqual("@profile:form_config"); + expect(data.bundleName).assertEqual("com.example.extensionmodule"); + expect(data.moduleName).assertEqual("phone"); + expect(data.name).assertEqual("ServiceExtAbility"); + expect(data.permissions.length).assertEqual(1); + expect(data.permissions[0]).assertEqual("ohos.permission.USE_BLUETOOTH"); + expect(data.isVisible).assertEqual(true); + expect(data.extensionAbilityType).assertLarger(0); + expect(data.readPermission).assertEqual(""); + expect(data.writePermission).assertEqual(""); + expect(data.enabled).assertEqual(true) + console.log("checkExtensionAbilityInfo3 end " + data); + } + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfotest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..eaefec3d4bbe202c7991216cb6f4c4a19f55d8a7 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.staticinformationmultihappackage", + "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/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..14e681ef14473acb496a0c926a394f50042347cf --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsStaticARelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsStaticARelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsstaticarelyhap_js_assets", + ":actsamsstaticarelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsstaticarelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsstaticarelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsstaticarelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsstaticarelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb674485fe00d57cf189c7d664daebe5f869ba43 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,83 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("ACTS_getAbilityInfo_0400 MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_getAbilityInfo_0400 MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("ACTS_getAbilityInfo_0400 MainAbility onForeground") + if (globalThis.abilityWant.action == 'startHapA') { + globalThis.abilityContext.startAbility({ + bundleName: "com.example.staticinformationmultihappackage", + abilityName: "com.example.feature.MainAbility", + action: "startHapB" + }, (error, data) => { + console.log('ACTS_getAbilityInfo_0400 MainAbility onForeground - startAbility restart singleton: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + commonEvent.publish("MainAbility_Start_CommonEvent_multi_hap_entry", { + parameters: { + hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), + applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), + abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) + } + }, (err) => { + console.log("ACTS_getAbilityInfo_0400 MainAbility Publish CallBack onForeground") + }); + } + console.log("ACTS_getAbilityInfo_0400 MainAbility onForeground") + + if (globalThis.abilityWant.action == 'multiple') { + commonEvent.publish("MainAbility_Start_CommonEvent_multiple_hap_entry", { + parameters: { + hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), + applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), + abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) + } + }, (err) => { + console.log("ACTS_getAbilityInfo_0400 MainAbility Publish CallBack onForeground") + }); + } + } + + onBackground() { + // Ability has back to background + console.log("ACTS_getAbilityInfo_0400 MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/index/index.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..29f9d54c2740fd91397020f76ef336885cfdffac --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json @@ -0,0 +1,83 @@ +{ + "module": { + "name": "com.example.staticinformationmultihappackage", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.staticinformationmultihappackage.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" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.USE_BLUETOOTH", + "reason":"need use ohos.permission.USE_BLUETOOTH" + } + ] + } +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..eaefec3d4bbe202c7991216cb6f4c4a19f55d8a7 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.staticinformationmultihappackage", + "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/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..4de043201c55f8069e4c6d07c46018abdd903c9e --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsStaticBRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsStaticBRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsstaticbrelyhap_js_assets", + ":actsamsstaticbrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsstaticbrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsstaticbrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsstaticbrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsstaticbrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d9fdcb92f81eac53bf51c78a428be0210c192b89 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} \ No newline at end of file diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..24d748e5f55a67d150224d910114cba48e929814 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,62 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("ACTS_getAbilityInfo_0400 MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_getAbilityInfo_0400 MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_getAbilityInfo_0400 MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("ACTS_getAbilityInfo_0400 MainAbility onForeground") + if (globalThis.abilityWant.action == 'startHapB') { + commonEvent.publish("MainAbility_Start_CommonEvent_multi_hap_feature", { + parameters: { + hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), + applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), + abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) + } + }, (err) => { + console.log("ACTS_getAbilityInfo_0400 MainAbility Publish CallBack onForeground") + }); + } + } + + onBackground() { + // Ability has back to background + console.log("ACTS_getAbilityInfo_0400 MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/index/index.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..ad3c7f20097ee1d14dffcb6bd1d5077753757723 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json @@ -0,0 +1,83 @@ +{ + "module": { + "name": "com.example.feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.feature.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" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.USE_BLUETOOTH", + "reason":"need use ohos.permission.USE_BLUETOOTH" + } + ] + } +} diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapa/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/app.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/BUILD.gn rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/BUILD.gn diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/Test.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/Test.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinfomationquerytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/app.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/BUILD.gn rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/BUILD.gn diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/Test.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/Test.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2917e26e6ef94aa1458612050ab765fce1c7c36 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,94 @@ +/* + * 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. + */ +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; +import commonEvent from '@ohos.commonEvent'; + +var subscriberInfo = { + events: ['MainAbility_Start_CommonEvent_multi_hap_entryB', 'MainAbility_Start_CommonEvent_multiple_hap_entry'] +}; + + +export default function abilityTest(abilityContext) { + describe('ActsAbilityMultipleTest', function () { + + /* + * @tc.number: ACTS_getAbilityInfo_0500 + * @tc.name: Starting singleton ability the second time does triggers onNewWant. + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_getAbilityInfo_0500', 0, async function (done) { + console.log("ACTS_getAbilityInfo_0500 --- start") + var Subscriber; + var EntryHap = false; + var FeatureHap = false; + + abilityContext.startAbility({ + bundleName: "com.example.staticquerytesttwo", + abilityName: "com.example.staticquerytesttwo.MainAbility", + action:"startmultiple" + }, (error, data) => { + console.log('ACTS_getAbilityInfo_0500 - startAbility start HapA: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_getAbilityInfo_0500====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + console.debug("ACTS_getAbilityInfo_0500====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_getAbilityInfo_0500====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + if (data.event == 'MainAbility_Start_CommonEvent_multi_hap_entryB') { + EntryHap = true; + console.log("ACTS_getAbilityInfo_0500====> MainAbility_Start_CommonEvent_multi_hap_entryB") + let abilityInfo = JSON.parse(data.parameters['abilityInfo']) + let hapModuleInfo = JSON.parse(data.parameters['hapModuleInfo']) + let applicationInfo =JSON.parse(data.parameters['applicationInfo']) + console.log("ACTS_getAbilityInfo_0500_entry_abilityInfo" + abilityInfo.name) + console.log("ACTS_getAbilityInfo_0500_entry_applicationInfo" + applicationInfo.name) + console.log("ACTS_getAbilityInfo_0500_entry_hapModuleInfo" + hapModuleInfo.name) + expect(abilityInfo.name).assertEqual("com.example.staticquerytesttwo.MainAbility"); + expect(applicationInfo.name).assertEqual("com.example.staticquerytesttwo"); + expect(hapModuleInfo.name).assertEqual("com.example.staticquerytesttwo"); + } else if (data.event == 'MainAbility_Start_CommonEvent_multiple_hap_entry'){ + FeatureHap = true; + console.log("ACTS_getAbilityInfo_0500====> MainAbility_Start_CommonEvent_multi_hap_feature") + let abilityInfo1 = JSON.parse(data.parameters['abilityInfo']) + let hapModuleInfo1 = JSON.parse(data.parameters['hapModuleInfo']) + let applicationInfo1 =JSON.parse(data.parameters['applicationInfo']) + console.log("ACTS_getAbilityInfo_0500_feature_abilityInfo" + abilityInfo1.name) + console.log("ACTS_getAbilityInfo_0500_feature_applicationInfo" + applicationInfo1.name) + console.log("ACTS_getAbilityInfo_0500_feature_hapModuleInfo" + hapModuleInfo1.name) + expect(abilityInfo1.name).assertEqual("com.example.staticinformationmultihappackage.MainAbility"); + expect(applicationInfo1.name).assertEqual("com.example.staticinformationmultihappackage"); + expect(hapModuleInfo1.name).assertEqual("com.example.staticinformationmultihappackage"); + } + if(EntryHap && FeatureHap){ + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + function UnSubscribeCallback() { + console.debug("ACTS_getAbilityInfo_0500====>UnSubscribe CallBack====>"); + done(); + } + }) + + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultipletest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/app.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/BUILD.gn rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/BUILD.gn diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/Test.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/Test.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..93fb15b9cfef9bb54b6a86da1012fc348be1598b --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,94 @@ +/* + * 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. + */ +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; +import commonEvent from '@ohos.commonEvent'; + +var subscriberInfo = { + events: ['MainAbility_Start_CommonEvent_multi_hap_entry', 'MainAbility_Start_CommonEvent_multi_hap_feature'], +}; + + +export default function abilityTest(abilityContext) { + describe('ActsAbilityMultiTest', function () { + + /** + * @tc.number: ACTS_getAbilityInfo_0400 + * @tc.name: Starting singleton ability the second time does triggers onNewWant. + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_getAbilityInfo_0400', 0, async function (done) { + console.log("ACTS_getAbilityInfo_0400 --- start") + var Subscriber; + var EntryHap = false; + var FeatureHap = false; + + abilityContext.startAbility({ + bundleName: "com.example.staticinformationmultihappackage", + abilityName: "com.example.staticinformationmultihappackage.MainAbility", + action:"startHapA" + }, (error, data) => { + console.log('ACTS_getAbilityInfo_0400 - startAbility start HapA: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_getAbilityInfo_0400====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + console.debug("ACTS_getAbilityInfo_0400====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_getAbilityInfo_0400====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + if (data.event == 'MainAbility_Start_CommonEvent_multi_hap_entry') { + EntryHap = true; + console.log("ACTS_getAbilityInfo_0400====> MainAbility_Start_CommonEvent_multi_hap_entry") + let abilityInfo = JSON.parse(data.parameters['abilityInfo']) + let hapModuleInfo = JSON.parse(data.parameters['hapModuleInfo']) + let applicationInfo =JSON.parse(data.parameters['applicationInfo']) + console.log("ACTS_getAbilityInfo_0400_entry_abilityInfo" + abilityInfo.name) + console.log("ACTS_getAbilityInfo_0400_entry_applicationInfo" + applicationInfo.name) + console.log("ACTS_getAbilityInfo_0400_entry_hapModuleInfo" + hapModuleInfo.name) + expect(abilityInfo.name).assertEqual("com.example.staticinformationmultihappackage.MainAbility"); + expect(applicationInfo.name).assertEqual("com.example.staticinformationmultihappackage"); + expect(hapModuleInfo.name).assertEqual("com.example.staticinformationmultihappackage"); + } else if (data.event == 'MainAbility_Start_CommonEvent_multi_hap_feature'){ + FeatureHap = true; + console.log("ACTS_getAbilityInfo_0400====> MainAbility_Start_CommonEvent_multi_hap_feature") + let abilityInfo1 = JSON.parse(data.parameters['abilityInfo']) + let hapModuleInfo1 = JSON.parse(data.parameters['hapModuleInfo']) + let applicationInfo1 =JSON.parse(data.parameters['applicationInfo']) + console.log("ACTS_getAbilityInfo_0400_feature_abilityInfo" + abilityInfo1.name) + console.log("ACTS_getAbilityInfo_0400_feature_applicationInfo" + applicationInfo1.name) + console.log("ACTS_getAbilityInfo_0400_feature_hapModuleInfo" + hapModuleInfo1.name) + expect(abilityInfo1.name).assertEqual("com.example.feature.MainAbility"); + expect(applicationInfo1.name).assertEqual("com.example.staticinformationmultihappackage"); + expect(hapModuleInfo1.name).assertEqual("com.example.feature"); + } + if(EntryHap && FeatureHap){ + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + function UnSubscribeCallback() { + console.debug("ACTS_getAbilityInfo_0400====>UnSubscribe CallBack====>"); + done(); + } + }) + + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticinformationmultitest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/app.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/app.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/app.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/BUILD.gn b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ca18977cc4a2f5da3d202e3efad6a4558cd4dc7a --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsAmsStaticQueryTestTwoRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsAmsStaticQueryTestTwoRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsamsstaticquerytesttworelyhap_js_assets", + ":actsamsstaticquerytesttworelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsamsstaticquerytesttworelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamsstaticquerytesttworelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamsstaticquerytesttworelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamsstaticquerytesttworelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/Test.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/Test.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/Test.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/Test.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/SecondMainAbility/SecondMainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/SecondMainAbility/SecondMainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2c0c39850097e77b6eddef894b87a4dcc935a91f --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/SecondMainAbility/SecondMainAbility.ts @@ -0,0 +1,65 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +export default class SecondAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("SecondAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("SecondAbility onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index", null) + globalThis.ability2Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("SecondAbility onForeground") + if (globalThis.abilityWant.action == 'getAbilityContext2') { + commonEvent.publish("SecondAbility_Start_CommonEvent_ability", { + parameters: { + hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), + applicationInfo: JSON.stringify(globalThis.abilityContext.applicationInfo), + abilityInfo: JSON.stringify(globalThis.abilityContext.abilityInfo) + } + } ,(err) => { + console.log("MainAbility Publish CallBack MainAbility_Start_CommonEvent") + }); + console.log('stub SerivceAbilityServer OnConnect start 2'); + } + } + + onBackground() { + // Ability has back to background + console.log("SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce8053f564753c18009ad74f4272e7687445f9c4 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,37 @@ +/* + * 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'; + +@Entry +@Component +struct Index { + + aboutToAppear() { + console.info("start run testcase!!!!") + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('querytesttwo') + .fontSize(50) + .fontWeight(FontWeight.Bold) + .margin({ + top: 20 + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/signature/openharmony_sx.p7b b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstaticquerytesttwohap/signature/openharmony_sx.p7b rename to ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amsdatauriutils/BUILD.gn b/ability/ability_runtime/amsdatauriutils/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/BUILD.gn rename to ability/ability_runtime/amsdatauriutils/BUILD.gn diff --git a/aafwk/aafwk_standard/amsdatauriutils/Test.json b/ability/ability_runtime/amsdatauriutils/Test.json similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/Test.json rename to ability/ability_runtime/amsdatauriutils/Test.json diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/config.json b/ability/ability_runtime/amsdatauriutils/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/config.json rename to ability/ability_runtime/amsdatauriutils/entry/src/main/config.json diff --git a/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/app.js b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amscontextualinforquery/actsamsstatichapb/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/resources/base/media/icon.png diff --git a/ability/ability_runtime/amsdatauriutils/entry/src/main/js/test/DataUriUtilsJsSt.test.js b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/test/DataUriUtilsJsSt.test.js new file mode 100644 index 0000000000000000000000000000000000000000..15e823cc7fa871be8b596d71c1e0a1e25a7a0c53 --- /dev/null +++ b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/test/DataUriUtilsJsSt.test.js @@ -0,0 +1,369 @@ +/* + * 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 dataUriUtils from '@ohos.ability.dataUriUtils' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsDataUriUtilsTest', function () { + +/* +* @tc.number: ACTS_getId_0100 +* @tc.name: getId : Obtains the ID attached to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_getId_0100', 0, function (done) { + console.log('dataUriUtils getId start1'); + var result = dataUriUtils.getId("com.ix.dataUriUtils/1221"); + console.log('dataUriUtils getId URI : ' + result); + + expect(typeof(result)).assertEqual("number"); + expect(result).assertEqual(1221); + console.log('dataUriUtils getId_test start1 successful'); + done(); + }) + +/* +* @tc.number: ACTS_getId_0200 +* @tc.name: getId : Obtains the ID attached to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_getId_0200', 0, function (done) { + console.log('dataUriUtils getId start2 '); + var result = dataUriUtils.getId("com.ix.dataUriUtils1221"); + console.log('dataUriUtils getId URI : ' + result); + + expect(typeof(result)).assertEqual("number"); + expect(result).assertEqual(-1); + console.log('dataUriUtils getId_test start2 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_getId_0300 +* @tc.name: getId : Obtains the ID attached to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_getId_0300', 0, function (done) { + console.log('dataUriUtils getId start3 '); + var result = dataUriUtils.getId("com.ix.dataUriUtils/11234567890"); + console.log('dataUriUtils getId URI : ' + result); + + expect(typeof(result)).assertEqual("number"); + expect(result).assertEqual(11234567890); + console.log('dataUriUtils getId_test start3 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_getId_0400 +* @tc.name: getId : Obtains the ID attached to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_getId_0400', 0, function (done) { + console.log('dataUriUtils getId start4 '); + var result = dataUriUtils.getId("com.ix.dataUriUtils"); + console.log('dataUriUtils getId URI : ' + result); + + expect(typeof(result)).assertEqual("number"); + expect(result).assertEqual(-1); + console.log('dataUriUtils getId_test start4 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_getId_0500 +* @tc.name: getId : Obtains the ID attached to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_getId_0500', 0, function (done) { + console.log('dataUriUtils getId start5 '); + var result = dataUriUtils.getId("com.ix.dataUriUtils/-777"); + console.log('dataUriUtils getId URI : ' + result);//-777 + + expect(typeof(result)).assertEqual("number"); + expect(result).assertEqual(-777); + console.log('dataUriUtils getId_test start5 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_attachId_0100 +* @tc.name: Attaches the given ID to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_attachId_0100',0, function (done) { + console.log('dataUriUtils attachId start1 '); + var idint = 1122; + var result = dataUriUtils.attachId("com.ix.dataUriUtils",idint); + console.log('dataUriUtils attachId URI :' + result) + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/1122"); + console.log('dataUriUtils attachId_test start1 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_attachId_0200 +* @tc.name: Attaches the given ID to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_attachId_0200',0, function (done) { + console.log('dataUriUtils attachId start2 '); + var idint = 0; + var result = dataUriUtils.attachId("com.ix.dataUriUtils/777",idint); + console.log('dataUriUtils attachId URI :' + result) + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/777/0"); + console.log('dataUriUtils attachId_test start2 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_attachId_0300 +* @tc.name: Attaches the given ID to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_attachId_0300',0, function (done) { + console.log('dataUriUtils attachId start3 '); + var idint = 456789; + var result = dataUriUtils.attachId("com.ix.dataUriUtils/123",idint); + console.log('dataUriUtils attachId URI :' + result) + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/123/456789"); + console.log('dataUriUtils attachId_test start3 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_attachId_0400 +* @tc.name: Attaches the given ID to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_attachId_0400',0, function (done) { + console.log('dataUriUtils attachId start4 '); + var idint = 123456789011; + var result = dataUriUtils.attachId("com.ix.dataUriUtils",idint); + console.log('dataUriUtils attachId URI :' + result) + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/123456789011"); + console.log('dataUriUtils attachId_test start4 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_attachId_0500 +* @tc.name: Attaches the given ID to the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_attachId_0500',0, function (done) { + console.log('dataUriUtils attachId start5 '); + var idint = -1; + var result = dataUriUtils.attachId("com.ix.dataUriUtils",idint); + console.log('dataUriUtils attachId URI :' + result) + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/-1"); + console.log('dataUriUtils attachId_test start5 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_deleteId_0100 +* @tc.name: Deletes the ID from the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_deleteId_0100',0, function (done) { + console.log('dataUriUtils deleteId start1 '); + var result = dataUriUtils.deleteId("com.ix.dataUriUtils"); + console.log('dataUriUtils deleteId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils"); + console.log('dataUriUtils deleteId_test start1 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_deleteId_0200 +* @tc.name: Deletes the ID from the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_deleteId_0200',0, function (done) { + console.log('dataUriUtils deleteId start2 '); + var result = dataUriUtils.deleteId("com.ix.dataUriUtils/1122"); + console.log('dataUriUtils deleteId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils"); + console.log('dataUriUtils deleteId_test start2 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_deleteId_0300 +* @tc.name: Deletes the ID from the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_deleteId_0300',0, function (done) { + console.log('dataUriUtils deleteId start3 '); + var result = dataUriUtils.deleteId("com.ix.dataUriUtils1122"); + console.log('dataUriUtils deleteId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils1122"); + console.log('dataUriUtils deleteId_test start3 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_deleteId_0400 +* @tc.name: Deletes the ID from the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_deleteId_0400',0, function (done) { + console.log('dataUriUtils deleteId start4 '); + var result = dataUriUtils.deleteId("com.ix.dataUriUtils/-1"); + console.log('dataUriUtils deleteId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils"); + console.log('dataUriUtils deleteId_test start4 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_deleteId_0500 +* @tc.name: Deletes the ID from the end of the path component of the given URI. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_deleteId_0500',0, function (done) { + console.log('dataUriUtils deleteId start5 '); + var result = dataUriUtils.deleteId("com.ix.dataUriUtils/1122/2211"); + console.log('dataUriUtils deleteId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/1122"); + console.log('dataUriUtils deleteId_test start5 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_updateId_0100 +* @tc.name: Updates the ID in the specified dataUri. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_updateId_0100',0, function (done) { + console.log('dataUriUtils updateId start1 '); + var idint = 1122; + var result = dataUriUtils.updateId("com.ix.dataUriUtils",idint); + console.log('updateId updateId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils"); + console.log('dataUriUtils updateId_test start1 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_updateId_0200 +* @tc.name: Updates the ID in the specified dataUri. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_updateId_0200',0, function (done) { + console.log('dataUriUtils updateId start2 '); + var idint = 1122; + var result = dataUriUtils.updateId("com.ix.dataUriUtils/",idint) + console.log('updateId updateId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/"); + console.log('dataUriUtils updateId_test start2 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_updateId_0300 +* @tc.name: Updates the ID in the specified dataUri. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_updateId_0300',0, function (done) { + console.log('dataUriUtils updateId start3 '); + var idint = 3344; + var result = dataUriUtils.updateId("com.ix.dataUriUtils/-1",idint) + console.log('updateId updateId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/3344"); + console.log('dataUriUtils updateId_test start3 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_updateId_0400 +* @tc.name: Updates the ID in the specified dataUri. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_updateId_0400',0, function (done) { + console.log('dataUriUtils updateId start4 '); + var idint = 5566; + var result = dataUriUtils.updateId("com.ix.dataUriUtils/123456789011",idint) + console.log('updateId updateId URI : ' + result); + + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/5566"); + console.log('dataUriUtils updateId_test start4 successful '); + + done(); + }) + +/* +* @tc.number: ACTS_updateId_0500 +* @tc.name: Updates the ID in the specified dataUri. +* @tc.desc: Check the return value of the interface +*/ + it('ACTS_updateId_0500',0, function (done) { + console.log('dataUriUtils updateId start5 '); + + var idint = 0; + expect(typeof(idint)).assertEqual("number"); + console.log('dataUriUtils updateId start666 '); + + var result = dataUriUtils.updateId("com.ix.dataUriUtils/1122",idint) + console.log('updateId updateId URI : ' + result); + expect(typeof(result)).assertEqual("string"); + expect(result).assertEqual("com.ix.dataUriUtils/0"); + done(); + }) +}) diff --git a/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/test/List.test.js b/ability/ability_runtime/amsdatauriutils/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/amsdatauriutils/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/amsdatauriutils/signature/openharmony_sx.p7b b/ability/ability_runtime/amsdatauriutils/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/signature/openharmony_sx.p7b rename to ability/ability_runtime/amsdatauriutils/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/BUILD.gn b/ability/ability_runtime/amsdisplayIdtest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/BUILD.gn rename to ability/ability_runtime/amsdisplayIdtest/BUILD.gn diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/app.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ef91bf3cc8469ada2b31934bab7608ca7d4689e6 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifytesthap", + "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/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/element/string.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/BUILD.gn b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/BUILD.gn rename to ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/BUILD.gn diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/Test.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b989a745e625abd167133072efe3efdaaca18718 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,113 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +var callBackSeq = ""; + +function publishCallBack() { + console.debug("====>Publish CallBack ====>"); +} + +async function startAbilityProcess(abilityContext, options, parameters) { + let bundleName; + let abilityName; + + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "testA": + bundleName = "com.example.actsspecifytesthap"; + abilityName = "com.example.actsspecifytesthap.MainAbility"; + break; + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters, + }, options, (error, data) => { + console.log('startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) +} + +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + var callBackData = "actsspecifytesthap:" + callBackData += callBackSeq; + + var commonEventPublishData = { + data: callBackData, + parameters: { + displayId: globalThis.abilityWant.parameters['ohos.aafwk.param.displayId'], + windowMode: globalThis.abilityWant.parameters['ohos.aafwk.param.windowMode'], +} + }; + + console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify(abilityWant)); + if (abilityWant.parameters.nextStep >= abilityWant.parameters.stepNum) { + commonEvent.publish("MultiInstanceStartFinish", commonEventPublishData, () => { + console.log('============>querytestsecond success==========>>') + callBackSeq = ""; + }); + } else { + commonEvent.publish("MultiInstanceStartNext", commonEventPublishData, () => { + callBackSeq = ""; + console.log('============>querytest success==========>>') + startAbilityProcess(globalThis.abilityContext, globalThis.abilityWant.options, abilityWant.parameters); + }); + } +} + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("actsspecifytesthap onCreate") + callBackSeq += "onCreate"; + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("actsspecifytesthap onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("actsspecifytesthap onWindowStageCreate") + // callBackSeq += "onWindowStageCreate"; + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index", null) + console.log("actsspecifytesthap onWindowStageCreate finish") + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("actsspecifytesthap onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("actsspecifytesthap onForeground") + callBackSeq += "onForeground"; + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("actsspecifytesthap onBackground") + } +}; diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/index/index.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7fc559d0628b0b6a53f6b450e3d917db28e803c7 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json @@ -0,0 +1,79 @@ +{ + "module": { + "name": "com.example.actsspecifytesthap", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifytesthap.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" + ] + } + ] + } + ], + "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.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason": "need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name": "ohos.permission.GET_RUNNING_INFO", + "reason": "need use ohos.permission.GET_RUNNING_INFO" + } + ] + } +} diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdatauriutils/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/signature/openharmony_sx.p7b b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/signature/openharmony_sx.p7b rename to ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/app.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/app.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/BUILD.gn b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/BUILD.gn rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/BUILD.gn diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/Test.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/Test.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/Test.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..a31169f2d6b5809fefca35db484f44872cb94c0a --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,72 @@ +/* + * 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 Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' + +async function onShowProcess() { + var abilityWant = globalThis.abilityWant; + + var commonEventPublishData = { + parameters: { + displayId: globalThis.abilityWant.parameters['ohos.aafwk.param.displayId'], + windowMode: globalThis.abilityWant.parameters['ohos.aafwk.param.windowMode'], + } + }; + + console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify(abilityWant)); + + commonEvent.publish("ACTS_TerminateSelf_CommonEvent", commonEventPublishData, () => { + console.log('============>querytestsecond success==========>>') + globalThis.abilityContext.terminateSelf(); + }); + +} +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + globalThis.abilityWant = want; + console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant)); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/second/second", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + onShowProcess(); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/app.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/app.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/app.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/app.ets diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..025b140b8c7979a68f2cedceec293ce6683fe0f2 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; + +export default class ServiceAbility extends ServiceExtension { + onCreate(want:Want) { + globalThis.abilityWant = want; + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + console.log('ServiceAbility registerApplicationStateObserver begin'); + } + + onConnect(want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + globalThis.extensionContext = this.context + if (want.action == 'getExtensionInfotwo') { + this.context.startAbility( + { + bundleName: 'com.example.startabilityforresult', + abilityName: 'com.example.startabilityforresult.MainAbility2' + }, + { + windowMode: 2, + displayId: 10, + }).then(() => { + console.log("====>end startAbility====>success!") + }) + console.log('stub SerivceAbilityServer OnConnect start 2'); + } + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/service.ts similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b0a2df289574a6549c8e3128f714c5b1bb8763e0 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,68 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" +var testTime = 0; + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + if(testTime++==0){ + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/AppScope/app.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/AppScope/app.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/AppScope/app.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/element/string.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/BUILD.gn b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/BUILD.gn rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/BUILD.gn diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/Test.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/Test.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/Test.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c93b7093fb2f95a3ad14c72a4f0d93cdd4ea54f0 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,321 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +import bundle from '@ohos.bundle' +import missionManager from '@ohos.application.missionManager' +import appManager from '@ohos.application.appManager' + + +var subscriberInfoMultiInstance = { + events: ["MultiInstanceStartNext", "MultiInstanceStartFinish", "TestAppOnForeground"] +}; +const START_ABILITY_TIMEOUT = 5000; +const MAX_MISSION_NUM = 1024; + +async function startAbilityProcess(abilityContext, options, parameters) { + let bundleName; + let abilityName; + + try { + let idx = parameters.nextStep; + switch (parameters.step[idx]) { + case "testA": + bundleName = "com.example.actsspecifytesthap"; + abilityName = "com.example.actsspecifytesthap.MainAbility"; + break; + default: + break; + } + parameters.nextStep = ++idx; + abilityContext.startAbility({ + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters, + }, options, (error, data) => { + console.log('startAbilityProcess result: ' + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + } catch (err) { + console.log('ACTS_getDisplayIdTest_0100 err: ' + err) + } +} + +function getMissionId() { + return new Promise(async (resolve, reject) => { + var missionId = -1; + var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); + for (let i = 0; i < missionInfos.length; i++) { + console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i])) + if ((missionInfos[i].want.abilityName == "com.example.actsgetdisplayidtest.MainAbility") && + (missionInfos[i].runningState == 0)) { + missionId = missionInfos[i].missionId; + break; + } + } + console.log('======>getMissionId resolve missionId<=======' + missionId); + resolve(missionId); + }) +} + +export default function abilityTest(abilityContext) { + describe('ActsGetDisplayIdStartAbilityTest', function () { + + afterEach(async (done) => { + var testMissionId; + + testMissionId = await getMissionId(); + console.log('======>afterEach test missionId<=======' + testMissionId); + await missionManager.moveMissionToFront(testMissionId); + await appManager.killProcessesByBundleName("com.example.actsspecifytesthap"); + done(); + }) + + + /* + * @tc.number: ACTS_StartAbility_0100 + * @tc.name: Get the specified displayId to start Ability + * @tc.desc: Verify Get displayId to start Ability + */ + it('ACTS_StartAbility_0100', 0, async function (done) { + console.log('ACTS_StartAbility_0100====ACTS_StartAbility_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + + async function processInfoCheck(data) { + console.info('====> ACTS_StartAbility_0100=====>'); + expect(data.parameters['displayId']).assertEqual(15); + expect(data.parameters['windowMode']).assertEqual(0); + done(); + } + + if (data.event == "MultiInstanceStartFinish") { + console.info('====> ACTS_StartAbility_0100 start success=====>'); + clearTimeout(id); + processInfoCheck(data); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } else if (data.event == "MultiInstanceStartNext") { + console.log('ACTS_StartAbility_0100 callBackSeq = ' + data.data); + } + } + + commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { + console.debug("====>Create0100 Subscriber====>"); + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe0100 CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.log('ACTS_StartAbility_0100 timeout'); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('Start ACTS_StartAbility_0100 timer id : ' + id); + + startAbilityProcess(abilityContext, { + windowMode: 0, + displayId: 15 + }, { + startId: 0, + stepNum: 1, + nextStep: 0, + step: ["testA"], + }); + }) + + /* + * @tc.number: ACTS_StartAbility_0200 + * @tc.name: Get the specified displayId to start Ability + * @tc.desc: Verify that the ability to start when displayId is a string + */ + it('ACTS_StartAbility_0200', 0, async function (done) { + console.log('ACTS_StartAbility_0200====ACTS_StartAbility_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + + async function processInfoCheck(data) { + console.info('====> ACTS_StartAbility_0200=====>'); + expect(data.parameters['displayId']).assertEqual(0); + expect(data.parameters['windowMode']).assertEqual(0); + done(); + } + + if (data.event == "MultiInstanceStartFinish") { + console.info('====> ACTS_StartAbility_0200 start success=====>'); + clearTimeout(id); + processInfoCheck(data); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } else if (data.event == "MultiInstanceStartNext") { + console.log('ACTS_StartAbility_0200 callBackSeq = ' + data.data); + } + } + + commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { + console.debug("====>Create0200 Subscriber====>"); + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe0200 CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.log('ACTS_StartAbility_0200 timeout'); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('Start ACTS_StartAbility_0200 timer id : ' + id); + + startAbilityProcess(abilityContext, { + windowMode: 0, + displayId: "abc" + }, { + startId: 0, + stepNum: 1, + nextStep: 0, + step: ["testA"] + }); + }) + + /* + * @tc.number: ACTS_StartAbility_0300 + * @tc.name: Get the specified displayId to start Ability + * @tc.desc: Verify that the ability to start when the displayId is undefined + */ + it('ACTS_StartAbility_0300', 0, async function (done) { + console.log('ACTS_StartAbility_0300====ACTS_StartAbility_0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + + async function processInfoCheck(data) { + console.info('====> ACTS_StartAbility_0300=====>'); + expect(data.parameters['displayId']).assertEqual(0); + expect(data.parameters['windowMode']).assertEqual(0); + done(); + } + + if (data.event == "MultiInstanceStartFinish") { + console.info('====> ACTS_StartAbility_0300 start success=====>'); + clearTimeout(id); + processInfoCheck(data); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } else if (data.event == "MultiInstanceStartNext") { + console.log('ACTS_StartAbility_0300 callBackSeq = ' + data.data); + } + } + + commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { + console.debug("====>Create0300 Subscriber====>"); + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe0300 CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.log('ACTS_StartAbility_0300 timeout'); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('Start ACTS_StartAbility_0300 timer id : ' + id); + + startAbilityProcess(abilityContext, { + windowMode: 0, + displayId: undefined + }, { + startId: 0, + stepNum: 1, + nextStep: 0, + step: ["testA"], + }); + }) + + /* + * @tc.number: ACTS_StartAbility_0400 + * @tc.name: Get the specified displayId to start Ability + * @tc.desc: Validation parameters want to filter the DISPLAY_ID of parameters + */ + it('ACTS_StartAbility_0400', 0, async function (done) { + console.log('ACTS_StartAbility_0400====ACTS_StartAbility_0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + + async function processInfoCheck(data) { + console.info('====> ACTS_StartAbility_0400=====>'); + expect(data.parameters['windowMode']).assertEqual(0); + expect(data.parameters['displayId']).assertEqual(0); + done(); + } + + if (data.event == "MultiInstanceStartFinish") { + console.info('====> ACTS_StartAbility_0400 start success=====>'); + clearTimeout(id); + processInfoCheck(data); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } else if (data.event == "MultiInstanceStartNext") { + console.log('ACTS_StartAbility_0400 callBackSeq = ' + data.data); + } + } + + commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => { + console.debug("====>Create0400 Subscriber====>"); + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe0400 CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.log('ACTS_StartAbility_0400 timeout'); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('Start ACTS_StartAbility_0400 timer id : ' + id); + + startAbilityProcess(abilityContext, {}, { + startId: 0, + stepNum: 1, + nextStep: 0, + step: ["testA"], + "ohos.aafwk.param.displayId": 10, + }); + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsstartabilitytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/BUILD.gn b/ability/ability_runtime/amsgetabilityprocessinfo/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/BUILD.gn rename to ability/ability_runtime/amsgetabilityprocessinfo/BUILD.gn diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/Test.json b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/Test.json similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/Test.json rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/Test.json diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/config.json b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/config.json rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/app.js b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/app.js similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/app.js rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/app.js diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/default/pages/index/index.js diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/ActsProcessManageJsTest.test.js b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/ActsProcessManageJsTest.test.js similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/ActsProcessManageJsTest.test.js rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/ActsProcessManageJsTest.test.js diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/List.test.js b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/signature/openharmony_sx.p7b b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/signature/openharmony_sx.p7b rename to ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/context/BUILD.gn b/ability/ability_runtime/context/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/BUILD.gn rename to ability/ability_runtime/context/BUILD.gn diff --git a/aafwk/aafwk_standard/context/actscontexttest/BUILD.gn b/ability/ability_runtime/context/actscontexttest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/BUILD.gn rename to ability/ability_runtime/context/actscontexttest/BUILD.gn diff --git a/aafwk/aafwk_standard/context/actscontexttest/Test.json b/ability/ability_runtime/context/actscontexttest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/Test.json rename to ability/ability_runtime/context/actscontexttest/Test.json diff --git a/ability/ability_runtime/context/actscontexttest/entry/src/main/config.json b/ability/ability_runtime/context/actscontexttest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d59f806e6b27d9965368456d247fc9875cc15843 --- /dev/null +++ b/ability/ability_runtime/context/actscontexttest/entry/src/main/config.json @@ -0,0 +1,105 @@ +{ + "app": { + "bundleName": "com.example.actscontext", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actscontext", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "reqPermissions": [ + { + "name": "com.example.permission", + "reason": "$string:permreason_example", + "usedScene": { + "ability": [ + "com.example.Ability", + "com.example.AbilityBackground" + ], + "when": "always" + } + }, + { + "name": "com.example.permission.user", + "reason": "$string:permreason_example", + "usedScene": { + "ability": [ + "com.example.Ability", + "com.example.AbilityBackground" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.example.actscontext.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/app.js b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/ability/ability_runtime/context/actscontexttest/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/context/actscontexttest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/i18n/en-US.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/i18n/zh-CN.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/pages/index/index.css old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/pages/index/index.hml old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/pages/index/index.js old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/context/actscontexttest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..46b750f3e5e680a790f8988520706bc404de9067 --- /dev/null +++ b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "permreason_example", + "value": "permreason example" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js rename to ability/ability_runtime/context/actscontexttest/entry/src/main/js/test/ContextJsunit.test.js diff --git a/ability/ability_runtime/context/actscontexttest/entry/src/main/js/test/List.test.js b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..77a9affcb88f6fbd11786d956973c8597500a915 --- /dev/null +++ b/ability/ability_runtime/context/actscontexttest/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./ContextJsunit.test.js') diff --git a/aafwk/aafwk_standard/context/actscontexttest/signature/openharmony_sx.p7b b/ability/ability_runtime/context/actscontexttest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/context/actscontexttest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/context/scene/defpermission/BUILD.gn b/ability/ability_runtime/context/scene/defpermission/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/BUILD.gn rename to ability/ability_runtime/context/scene/defpermission/BUILD.gn diff --git a/aafwk/aafwk_standard/context/scene/defpermission/Test.json b/ability/ability_runtime/context/scene/defpermission/Test.json similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/Test.json rename to ability/ability_runtime/context/scene/defpermission/Test.json diff --git a/aafwk/aafwk_standard/context/scene/defpermission/signature/openharmony_sx.p7b b/ability/ability_runtime/context/scene/defpermission/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/signature/openharmony_sx.p7b rename to ability/ability_runtime/context/scene/defpermission/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/context/scene/defpermission/src/main/config.json b/ability/ability_runtime/context/scene/defpermission/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..f44aa58fdc9d24cd8361fb5e4201d37334725665 --- /dev/null +++ b/ability/ability_runtime/context/scene/defpermission/src/main/config.json @@ -0,0 +1,94 @@ +{ + "app": { + "bundleName": "com.example.defpermission", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.defpermission", + "name": ".MyApplication", + "defPermissions": [ + { + "name": "com.example.permission", + "grantMode": "system_grant", + "availableScope": [] + }, + { + "name": "com.example.permission.user", + "grantMode": "user_grant", + "availableScope": [] + } + ], + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.defpermission.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/scene/defpermission/src/main/js/default/app.js b/ability/ability_runtime/context/scene/defpermission/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/ability/ability_runtime/context/scene/defpermission/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/context/scene/defpermission/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/context/scene/defpermission/src/main/js/default/i18n/en-US.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/context/scene/defpermission/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/context/scene/defpermission/src/main/js/default/i18n/zh-CN.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/context/scene/defpermission/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/pages/index/index.css b/ability/ability_runtime/context/scene/defpermission/src/main/js/default/pages/index/index.css old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/context/scene/defpermission/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/context/scene/defpermission/src/main/js/default/pages/index/index.hml old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/context/scene/defpermission/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/pages/index/index.js b/ability/ability_runtime/context/scene/defpermission/src/main/js/default/pages/index/index.js old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/context/scene/defpermission/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/context/scene/defpermission/src/main/js/resources/base/element/string.json b/ability/ability_runtime/context/scene/defpermission/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63 --- /dev/null +++ b/ability/ability_runtime/context/scene/defpermission/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/context/scene/defpermission/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/context/actscontexttest/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/context/scene/defpermission/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/fa/BUILD.gn b/ability/ability_runtime/fa/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/fa/BUILD.gn rename to ability/ability_runtime/fa/BUILD.gn diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/BUILD.gn b/ability/ability_runtime/fa/faapplicationinfo/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/BUILD.gn rename to ability/ability_runtime/fa/faapplicationinfo/BUILD.gn diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/Test.json b/ability/ability_runtime/fa/faapplicationinfo/Test.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/Test.json rename to ability/ability_runtime/fa/faapplicationinfo/Test.json diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/config.json b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/config.json rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/app.js b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/app.js rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/app.js diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/en-US.json b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/en-US.json rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/zh-CN.json b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/zh-CN.json rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.css rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.hml b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.hml rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.hml diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.js rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/app.js b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/app.js rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/app.js diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/en-US.json b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/en-US.json rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/zh-CN.json b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/zh-CN.json rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.css b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.css rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.hml b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.hml rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.hml diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.js b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.js rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/MainAbility2/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/context/scene/defpermission/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/context/scene/defpermission/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/resources/base/media/icon.png diff --git a/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/test/ApplicationInfoJsunit.test.js b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/test/ApplicationInfoJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c9b0173ad31bf14146dbc4180688d12162b978b5 --- /dev/null +++ b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/test/ApplicationInfoJsunit.test.js @@ -0,0 +1,137 @@ +/* + * 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 commonEvent from '@ohos.commonEvent' +import featureAbility from '@ohos.ability.featureAbility' +import formBindingData from '@ohos.application.formBindingData' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +var getCallingBundleUri = { + events: ['SUB_AA_OpenHarmony_Want_0200_CommonEvent'] +} + +var getCallingBundleType = { + events: ['SUB_AA_OpenHarmony_Want_0300_CommonEvent'] +} + +describe('ApplicationInfoTest', function () { + var TAG = '';- + + /* + * @tc.number SUB_AA_OpenHarmony_FormBase_1000 + * @tc.name Validate formbindingdata creation data + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_FormBase_1000', 0, async function (done) { + console.info('------------start SUB_AA_OpenHarmony_FormBase_1000-------------'); + TAG = 'SUB_AA_OpenHarmony_FormBase_1000'; + var dataObj = { + temperature:"11c", + "time":"11:00", + "test":11, + "test3":true + } + var result = formBindingData.createFormBindingData(dataObj) + console.log(TAG + " result is : " + JSON.stringify(result)) + expect(JSON.stringify(result)). + assertEqual(JSON.stringify({"data":"{\"temperature\":\"11c\",\"time\":\"11:00\",\"test\":11,\"test3\":true}"})); + done(); + console.info('------------end SUB_AA_OpenHarmony_FormBase_1000-------------'); + }); + + /* + * @tc.number SUB_AA_OpenHarmony_Want_0200 + * @tc.name Switching the mission in the launcherlist to the foreground is not supported + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_Want_0200', 0, async function (done) { + console.info('------------start SUB_AA_OpenHarmony_Want_0200-------------'); + TAG = 'SUB_AA_OpenHarmony_Want_0200'; + var Subscriber = ''; + + function SubscribeCallBackUri(err, data) { + console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err)); + expect(data.data == '{true,true,false}').assertTrue(); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + done(); + } + + function UnSubscribeCallback() { + console.debug(TAG + "====>UnSubscribe CallBack====>"); + done(); + } + + commonEvent.createSubscriber(getCallingBundleUri).then(async (data) => { + console.info(TAG + '====>Create Subscriber===='); + Subscriber = data; + console.info(TAG + '====>Create Subscriber====' + JSON.stringify(data) ); + await commonEvent.subscribe(Subscriber, SubscribeCallBackUri); + }); + + featureAbility.startAbility({ + want: { + abilityName: 'com.example.applicationinfo.MainAbility2', + bundleName: 'com.example.applicationinfo', + uri: '{true,true,false}' + } + }, (err, data) => { + console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data)); + }); + console.info('------------end SUB_AA_OpenHarmony_Want_0200-------------'); + }); + + /* + * @tc.number SUB_AA_OpenHarmony_Want_0300 + * @tc.name Switching the mission in the launcherlist to the foreground is not supported + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_Want_0300', 0, async function (done) { + console.info('------------start SUB_AA_OpenHarmony_Want_0300-------------'); + TAG = 'SUB_AA_OpenHarmony_Want_0300'; + var Subscriber = ''; + + function SubscribeCallBackType(err, data) { + console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err)); + expect(data.data == 'MIMETYPE').assertTrue(); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + done(); + } + + function UnSubscribeCallback() { + console.debug(TAG + "====>UnSubscribe CallBack====>"); + done(); + } + + commonEvent.createSubscriber(getCallingBundleType).then(async (data) => { + console.info(TAG + '====>Create Subscriber====>'); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBackType); + }); + + featureAbility.startAbility({ + want: { + abilityName: 'com.example.applicationinfo.MainAbility2', + bundleName: 'com.example.applicationinfo', + type: 'MIMETYPE', + } + }, (err, data) => { + console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data)); + }); + console.info('------------end SUB_AA_OpenHarmony_Want_0300-------------'); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/test/List.test.js b/ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/fa/faapplicationinfo/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/signature/openharmony_sx.p7b b/ability/ability_runtime/fa/faapplicationinfo/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/signature/openharmony_sx.p7b rename to ability/ability_runtime/fa/faapplicationinfo/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/BUILD.gn b/ability/ability_runtime/fa/faconfigurationconstant/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/BUILD.gn rename to ability/ability_runtime/fa/faconfigurationconstant/BUILD.gn diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/Test.json b/ability/ability_runtime/fa/faconfigurationconstant/Test.json similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/Test.json rename to ability/ability_runtime/fa/faconfigurationconstant/Test.json diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/config.json b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/config.json rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/config.json diff --git a/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/app.js b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/fa/faapplicationinfo/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/test/JsConfiguration.test.js b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/test/JsConfiguration.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/test/JsConfiguration.test.js rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/test/JsConfiguration.test.js diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/test/List.test.js b/ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/fa/faconfigurationconstant/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/signature/openharmony_sx.p7b b/ability/ability_runtime/fa/faconfigurationconstant/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/signature/openharmony_sx.p7b rename to ability/ability_runtime/fa/faconfigurationconstant/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/fa/facoverapi/BUILD.gn b/ability/ability_runtime/fa/facoverapi/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/BUILD.gn rename to ability/ability_runtime/fa/facoverapi/BUILD.gn diff --git a/aafwk/aafwk_standard/fa/facoverapi/Test.json b/ability/ability_runtime/fa/facoverapi/Test.json similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/Test.json rename to ability/ability_runtime/fa/facoverapi/Test.json diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/config.json b/ability/ability_runtime/fa/facoverapi/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/config.json rename to ability/ability_runtime/fa/facoverapi/entry/src/main/config.json diff --git a/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/app.js b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/i18n/zh-CN.json diff --git a/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..6069a046a35c4409ab85e4595a079a1670a9c7fe --- /dev/null +++ b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/fa/facoverapi/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/fa/facoverapi/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76e501f214f84c96a44d08973dbbdeab8515e1de --- /dev/null +++ b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/fa/faconfigurationconstant/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/fa/facoverapi/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/test/JsCoverApi.test.js b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/test/JsCoverApi.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/test/JsCoverApi.test.js rename to ability/ability_runtime/fa/facoverapi/entry/src/main/js/test/JsCoverApi.test.js diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/test/List.test.js b/ability/ability_runtime/fa/facoverapi/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/fa/facoverapi/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/fa/facoverapi/signature/openharmony_sx.p7b b/ability/ability_runtime/fa/facoverapi/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/signature/openharmony_sx.p7b rename to ability/ability_runtime/fa/facoverapi/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/BUILD.gn b/ability/ability_runtime/fa/faequeryabilitybywant/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/BUILD.gn rename to ability/ability_runtime/fa/faequeryabilitybywant/BUILD.gn diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/Test.json b/ability/ability_runtime/fa/faequeryabilitybywant/Test.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/Test.json rename to ability/ability_runtime/fa/faequeryabilitybywant/Test.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/config.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/config.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/app.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/app.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/app.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/en-US.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/en-US.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/zh-CN.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/zh-CN.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility/pages/second/second.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/app.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/app.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/app.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/en-US.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/en-US.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/zh-CN.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/zh-CN.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility2/pages/second/second.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/app.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/app.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/app.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/en-US.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/en-US.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/zh-CN.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/zh-CN.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility3/pages/second/second.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/app.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/app.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/app.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/app.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/en-US.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/en-US.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/en-US.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/zh-CN.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/zh-CN.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/index/index.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.css b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.css similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.css rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.css diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.hml b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.hml similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.hml rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.hml diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/MainAbility4/pages/second/second.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/ServiceAbility/service.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/ServiceAbility/service.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/ServiceAbility/service.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/ServiceAbility/service.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/fa/facoverapi/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/test/JsAbilityDisable.test.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/test/JsAbilityDisable.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/test/JsAbilityDisable.test.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/test/JsAbilityDisable.test.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/test/List.test.js b/ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/test/List.test.js similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/fa/faequeryabilitybywant/entry/src/main/js/test/List.test.js diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/signature/openharmony_sx.p7b b/ability/ability_runtime/fa/faequeryabilitybywant/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/signature/openharmony_sx.p7b rename to ability/ability_runtime/fa/faequeryabilitybywant/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/BUILD.gn b/ability/ability_runtime/featureability/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/BUILD.gn rename to ability/ability_runtime/featureability/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/BUILD.gn b/ability/ability_runtime/featureability/actsfeatureabilitytest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/BUILD.gn rename to ability/ability_runtime/featureability/actsfeatureabilitytest/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/Test.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/Test.json rename to ability/ability_runtime/featureability/actsfeatureabilitytest/Test.json diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..41ab7b3ff4fbdf016cf8ada2b11715cfc2c0d56a --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json @@ -0,0 +1,119 @@ +{ + "app": { + "bundleName": "com.example.actsfeatureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": { + "default": { + "process": "processTest" + } + }, + "module": { + "package": "com.example.actsfeatureabilitytest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home" + ] + } + ], + "backgroundModes": [ + "dataTransfer" + ], + "name": "com.example.actsfeatureabilitytest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton", + "process": "processTestAbility", + "permissions": ["ohos.permission.ACCELEROMETER"], + "deviceCapability": ["ability_base","ability_runtime"], + "uri": "uriTest", + "visible": true + } + ], + "reqCapabilities": ["reqCapabilitiesTest1","reqCapabilitiesTest2"], + "description": "descriptionTest", + "defPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.CAMERA", + "reason": "$string:permreason_camera", + "usedScene": + { + "ability": ["com.mycamera.Ability", "com.mycamera.AbilityBackground"], + "when": "always" + } + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" + }, + { + "name": "ohos.permission.ACCELEROMETER", + "reason":"need use ohos.permission.ACCELEROMETER" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..41e9180299771ac021dde0786de080a5c20175f7 --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsfeatureabilitytest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "permreason_camera", + "value": "permreason camera" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/fa/faequeryabilitybywant/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/media/icon.png diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f98cddd8d2e30a3ac6b5d2103e0fc0cb3148356f --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,2153 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import wantconstant from '@ohos.ability.wantConstant' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import commonEvent from '@ohos.commonEvent' +import notification from '@ohos.notification'; +import wantAgent from '@ohos.wantAgent'; +import particleAbility from '@ohos.ability.particleAbility' +import backgroundTaskManager from '@ohos.backgroundTaskManager' + +const CREATELOCALDIR = "/data/storage/el2/base/haps/entry"; +const START_ABILITY_TIMEOUT = 4000; +const TERMINATE_ABILITY_TIMEOUT = 1000; +const TIMEOUT = 1000; +var subscriberInfo_ACTS_StartAbility_0100 = { + events: ["ACTS_StartAbility_0100_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbility_0200 = { + events: ["ACTS_StartAbility_0200_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbility_0300 = { + events: ["ACTS_StartAbility_0300_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbility_0400 = { + events: ["ACTS_StartAbility_0400_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbility_0500 = { + events: ["ACTS_StartAbility_0500_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbility_0600 = { + events: ["ACTS_StartAbility_0600_CommonEvent"], +}; +var subscriberInfoStartAbilityTen = { + events: ["ACTS_StartAbility_1000_CommonEvent"], +}; +var subscriberInfoStartAbilityThirteen = { + events: ["ACTS_StartAbility_1300_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbilityForResult_0100 = { + events: ["ACTS_StartAbilityForResult_0100_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbilityForResult_0200 = { + events: ["ACTS_StartAbilityForResult_0200_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbilityForResult_0300 = { + events: ["ACTS_StartAbilityForResult_0300_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbilityForResult_0400 = { + events: ["ACTS_StartAbilityForResult_0400_CommonEvent"], +}; +var subscriberInfo_ACTS_StartAbilityForResult_0500 = { + events: ["ACTS_StartAbilityForResult_0500_CommonEvent"], +}; +var subscriberInfoStartAbilityForResultSix = { + events: ["ACTS_StartAbilityForResult_0600_CommonEvent"], +}; +var subscriberInfo_ACTS_TerminateAbility_0100 = { + events: ["ACTS_TerminateAbility_0100_CommonEvent", + "ACTS_TerminateAbility_0100_Return"], +}; +var subscriberInfoTerminateAbilityTwo = { + events: ["ACTS_TerminateAbility_0200_CommonEvent", + "ACTS_TerminateAbility_0200_Return"], +}; +var subscriberInfo_ACTS_FinishWithResult_0100 = { + events: ["ACTS_FinishWithResult_0100_CommonEvent"], +}; +var subscriberInfo_ACTS_GetCallingBundle_0100 = { + events: ["ACTS_GetCallingBundle_0100_CommonEvent", + "com.example.actsfeatureabilitytest.promise", + "com.example.actsfeatureabilitytest.callback"], +}; + +describe('ActsFeatureAbilityTest', function () { + + beforeAll(function() { + + /* + * @tc.setup: setup invoked before all testcases + */ + console.info('beforeAll called') + }) + + afterAll(function() { + + /* + * @tc.teardown: teardown invoked after all testcases + */ + console.info('afterAll called') + }) + + beforeEach(function() { + + /* + * @tc.setup: setup invoked before each testcases + */ + console.info('beforeEach called') + }) + + afterEach(function() { + + /* + * @tc.teardown: teardown invoked after each testcases + */ + console.info('afterEach called') + particleAbility.cancelBackgroundRunning(); + setTimeout(() => {}, 500); + backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()); + setTimeout(() => {}, 500); + }) + + /* + * @tc.name:Acts_ContinuousTask_0100 + * @tc.desc:verify new startBackgroundrunning interface promise mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT7U AR000GH6ER AR000GH6EM AR000GH6EN AR000GH6EO + */ + it("Acts_ContinuousTask_0100", 0, async function (done) { + console.log("Acts_ContinuousTask_0100 start"); + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + wantAgent.getWantAgent(wantAgentInfo).then((data) => { + backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then(() => { + console.log("Acts_ContinuousTask_0100 startBackgroundRunning success"); + expect(true).assertTrue(); + setTimeout(() => { + done(); + }, 500); + }).catch((err) => { + expect(false).assertTrue(); + console.log("Acts_ContinuousTask_0100 startBackgroundRunning failure"); + setTimeout(() => { + done(); + }, 500); + }); + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0200 + * @tc.desc:verify new startBackgroundrunning interface callback mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT7T AR000GH6ER AR000GH6EP AR000GJ9PR AR000GH6G8 + */ + it("Acts_ContinuousTask_0200", 0, async function (done) { + console.log("Acts_ContinuousTask_0200 start"); + function conTaskCallback(err, data) { + if (err) { + console.info('Acts_ContinuousTask_0200 startBackgroundRunning failed'); + expect(false).assertTrue(); + } else { + console.info('Acts_ContinuousTask_0200 startBackgroundRunning succeed'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + } + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + wantAgent.getWantAgent(wantAgentInfo).then((data) => { + backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data, conTaskCallback); + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0300 + * @tc.desc:verify old startBackgroundrunning interface promise mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT7V AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH56K + */ + it("Acts_ContinuousTask_0300", 0, async function (done) { + console.log("Acts_ContinuousTask_0300 start"); + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + wantAgent.getWantAgent(wantAgentInfo).then((data) => { + let basicContent = { + title: "title", + text: "text" + }; + + let notificationContent = { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: basicContent + }; + + let request = { + content: notificationContent, + wantAgent: data + } + + let id = 1; + + particleAbility.startBackgroundRunning(id, request).then((data) => { + console.log("Acts_ContinuousTask_0300 startBackgroundRunning success"); + expect(true).assertTrue(); + setTimeout(() => { + done(); + }, 500); + }).catch((err) => { + expect(false).assertTrue(); + console.log("Acts_ContinuousTask_0300 startBackgroundRunning failure"); + setTimeout(() => { + done(); + }, 500); + }); + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0400 + * @tc.desc:verify old startBackgroundrunning interface callback mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT81 AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH6ET + */ + it("Acts_ContinuousTask_0400", 0, async function (done) { + console.log("Acts_ContinuousTask_0400 start"); + function conTaskCallback(err, data) { + if (err) { + console.info('Acts_ContinuousTask_0400 startBackgroundRunning failure'); + expect(false).assertTrue(); + } else { + console.info('Acts_ContinuousTask_0400 startBackgroundRunning success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + } + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + wantAgent.getWantAgent(wantAgentInfo).then((data) => { + let basicContent = { + title: "title", + text: "text" + }; + + let notificationContent = { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: basicContent + }; + + let request = { + content: notificationContent, + wantAgent: data + } + + let id = 1; + + particleAbility.startBackgroundRunning(id, request, conTaskCallback); + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0500 + * @tc.desc:verify new api stopBackgroundrunning interface promise mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT7U AR000GH6ES AR000GH6EM AR000GH6EN AR000GH6EO + */ + it("Acts_ContinuousTask_0500", 0, async function (done) { + console.log("Acts_ContinuousTask_0500 start"); + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + wantAgent.getWantAgent(wantAgentInfo).then((data) => { + backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then((data) => { + backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then((data) => { + console.log("Acts_ContinuousTask_0500 cancelBackgroundRunning success"); + expect(true).assertTrue(); + setTimeout(() => { + done(); + }, 500); + }).catch((err) => { + expect(false).assertTrue(); + console.log("Acts_ContinuousTask_0500 cancelBackgroundRunning failure"); + setTimeout(() => { + done(); + }, 500); + }); + }) + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0600 + * @tc.desc:verify new api stopBackgroundrunning interface callback mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT7T AR000GH6ES AR000GH6EP AR000GJ9PR AR000GH6G8 + */ + it("Acts_ContinuousTask_0600", 0, async function (done) { + console.log("Acts_ContinuousTask_0600 start"); + function conTaskCallback(err, data) { + if (err) { + console.info('Acts_ContinuousTask_0600 startBackgroundRunning failure'); + expect(false).assertTrue(); + } else { + console.info('Acts_ContinuousTask_0600 startBackgroundRunning success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + } + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + wantAgent.getWantAgent(wantAgentInfo).then((data) => { + backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then((data) => { + backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext(), conTaskCallback); + }) + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0700 + * @tc.desc:verify old api cancelBackgroundrunning interface promise mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT7V AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH56K + */ + it("Acts_ContinuousTask_0700", 0, async function (done) { + console.log("Acts_ContinuousTask_0700 start"); + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + await wantAgent.getWantAgent(wantAgentInfo).then((data) => { + particleAbility.startBackgroundRunning(data); + setTimeout(()=>{ + }, 500); + }); + + particleAbility.cancelBackgroundRunning().then(() => { + console.log("Acts_ContinuousTask_0700 cancelBackgroundRunning success"); + expect(true).assertTrue(); + setTimeout(() => { + done(); + }, 500); + }).catch( (err) => { + expect(false).assertTrue(); + console.log("Acts_ContinuousTask_0700 cancelBackgroundRunning failure"); + setTimeout(() => { + done(); + }, 500); + }); + }) + + /* + * @tc.name:Acts_ContinuousTask_0800 + * @tc.desc:verify old cancelBackgroundrunning interface callback mode work properly + * @tc.type: FUNC + * @tc.require: SR000GGT81 AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH6ET + */ + it("Acts_ContinuousTask_0800", 0, async function (done) { + console.log("Acts_ContinuousTask_0800 start"); + function conTaskCallback(err, data) { + if (err) { + console.info('Acts_ContinuousTask_0800 startBackgroundRunning failure'); + expect(false).assertTrue(); + } else { + console.info('Acts_ContinuousTask_0800 startBackgroundRunning success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + } + let wantAgentInfo = { + wants: [ + { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.MainAbility" + } + ], + operationType: 2, + requestCode: 0, + wantAgentFlags: [3] + }; + await wantAgent.getWantAgent(wantAgentInfo).then((data) => { + particleAbility.startBackgroundRunning(data); + setTimeout(()=>{ + }, 500); + }); + + particleAbility.cancelBackgroundRunning(conTaskCallback); + }) + + /** + * @tc.number: ACTS_wantConstant_0100 + * @tc.name: wantConstant : Check specific enum + * @tc.desc: Check the return type of the interface (by Promise) + */ + it('ACTS_wantConstant_0100', 0, async function (done) { + expect(wantconstant.Action.ACTION_HOME).assertEqual("ohos.want.action.home"); + expect(wantconstant.Action.ACTION_DIAL).assertEqual("ohos.want.action.dial"); + expect(wantconstant.Action.ACTION_SEARCH).assertEqual("ohos.want.action.search"); + expect(wantconstant.Action.ACTION_WIRELESS_SETTINGS).assertEqual("ohos.settings.wireless"); + expect(wantconstant.Action.ACTION_MANAGE_APPLICATIONS_SETTINGS).assertEqual("ohos.settings.manage.applications"); + expect(wantconstant.Action.ACTION_APPLICATION_DETAILS_SETTINGS).assertEqual("ohos.settings.application.details"); + expect(wantconstant.Action.ACTION_SET_ALARM).assertEqual("ohos.want.action.setAlarm"); + expect(wantconstant.Action.ACTION_SHOW_ALARMS).assertEqual("ohos.want.action.showAlarms"); + expect(wantconstant.Action.ACTION_SNOOZE_ALARM).assertEqual("ohos.want.action.snoozeAlarm"); + expect(wantconstant.Action.ACTION_DISMISS_ALARM).assertEqual("ohos.want.action.dismissAlarm"); + expect(wantconstant.Action.ACTION_DISMISS_TIMER).assertEqual("ohos.want.action.dismissTimer"); + expect(wantconstant.Action.ACTION_SEND_SMS).assertEqual("ohos.want.action.sendSms"); + expect(wantconstant.Action.ACTION_CHOOSE).assertEqual("ohos.want.action.choose"); + expect(wantconstant.Action.ACTION_SELECT).assertEqual("ohos.want.action.select"); + expect(wantconstant.Action.ACTION_SEND_DATA).assertEqual("ohos.want.action.sendData"); + expect(wantconstant.Action.ACTION_SEND_MULTIPLE_DATA).assertEqual("ohos.want.action.sendMultipleData"); + expect(wantconstant.Action.ACTION_SCAN_MEDIA_FILE).assertEqual("ohos.want.action.scanMediaFile"); + expect(wantconstant.Action.ACTION_VIEW_DATA).assertEqual("ohos.want.action.viewData"); + expect(wantconstant.Action.ACTION_EDIT_DATA).assertEqual("ohos.want.action.editData"); + expect(wantconstant.Action.INTENT_PARAMS_INTENT).assertEqual("ability.want.params.INTENT"); + expect(wantconstant.Action.INTENT_PARAMS_TITLE).assertEqual("ability.want.params.TITLE"); + expect(wantconstant.Action.ACTION_FILE_SELECT).assertEqual("ohos.action.fileSelect"); + expect(wantconstant.Action.PARAMS_STREAM).assertEqual("ability.params.stream"); + + expect(wantconstant.Entity.ENTITY_HOME).assertEqual("entity.system.home"); + expect(wantconstant.Entity.ENTITY_DEFAULT).assertEqual("entity.system.default"); + expect(wantconstant.Entity.ENTITY_VOICE).assertEqual("entity.system.voice"); + expect(wantconstant.Entity.ENTITY_BROWSABLE).assertEqual("entity.system.browsable"); + expect(wantconstant.Entity.ENTITY_VIDEO).assertEqual("entity.system.video"); + done(); + }) + + /** + * @tc.number: ACTS_GetContext_0100 + * @tc.name: GetContext : Obtains the Context object + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_GetContext_0100', 0, async function (done) { + var promise = await featureAbility.getContext() + expect(typeof (promise)).assertEqual("object"); + done(); + }) + + /** + * @tc.number: ACTS_HasWindowFocus_0100 + * @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_HasWindowFocus_0100', 0, async function (done) { + var promise = featureAbility.hasWindowFocus(); + expect(typeof (promise)).assertEqual("object"); + var info = await featureAbility.hasWindowFocus(); + expect(info).assertEqual(true); + done(); + setTimeout(function () { + console.info('====> ACTS_HasWindowFocus_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_HasWindowFocus_0300 + * @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_HasWindowFocus_0300', 0, async function (done) { + var result = featureAbility.hasWindowFocus( + (err, data) => { + console.log("hasWindowFocus asyncCallback code: " + err.code + " data: " + data); + expect(err.code).assertEqual(0); + expect(data).assertTrue(); + done() + } + ); + console.info('AceApplication : hasWindowFocus : ' + result); + setTimeout(function () { + console.info('====> ACTS_HasWindowFocus_0300 =====>') + }, TIMEOUT) + }) + + /* + * @tc.number ACTS_StartAbility_1000 + * @tc.name The configured URI is started and the page is not configured + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1000",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1000-------------------"); + try{ + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_1000_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + done(); + } + + commonEvent.createSubscriber(subscriberInfoStartAbilityTen).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_1000=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + let Want = { + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "xxxxx", + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_1000 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + expect(err.code == 0).assertTrue(); + }); + }catch(error){ + console.log("ACTS_StartAbility_1000 : error = " + error); + } + }) + + /** + * @tc.number: ACTS_StartAbility_0100 + * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_StartAbility_0100', 0, async function (done) { + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_0100_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + done(); + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0100).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_0100=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var promise = await featureAbility.startAbility( + { + want: + { + action: "action.system.homeability", + entities: ["entity.system.home"], + type: "MIMETYPE", + options: { + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "" + }, + } + ); + expect(promise).assertEqual(0); + }) + + /** + * @tc.number: ACTS_StartAbility_0200 + * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + * @tc.desc: Pass the parameters, Check the return value of the interface (by Promise) + */ + it('ACTS_StartAbility_0200', 0, async function (done) { + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_0200_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0200).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_0200=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug('=======wait id======'); + var promise = await featureAbility.startAbility( + { + want: + { + action: "action.system.homeability", + entities: ["entity.system.home"], + type: "MIMETYPE", + options: { + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "", + parameters: + { + mykey0: 1111, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "xxxxxxxxxxxxxxxxxxxxxx", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], + mykey7: true, + }, + }, + } + ); + expect(promise).assertEqual(0); + }) + + /** + * @tc.number: ACTS_StartAbility_0300 + * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + * @tc.desc: Passing null, Check the return value of the interface (by Promise) + */ + it('ACTS_StartAbility_0300', 0, async function (done) { + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_0300_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0300).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_0300=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var promise = await featureAbility.startAbility( + { + want: + { + action: "", + entities: [""], + type: "", + options: { + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "" + }, + } + ); + expect(promise).assertEqual(0); + }) + + /** + * @tc.number: ACTS_StartAbility_0400 + * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_StartAbility_0400', 0, async function (done) { + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_0400_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0400).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_0400=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var result = featureAbility.startAbility( + { + want: + { + action: "action.system.homeability", + entities: ["entity.system.home"], + type: "MIMETYPE", + options: { + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "" + }, + }, + (error, data) => { + console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) + + }, + ); + }) + + /** + * @tc.number: ACTS_StartAbility_0500 + * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + * @tc.desc: Pass the parameters, Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_StartAbility_0500', 0, async function (done) { + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_0500_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0500).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_0500=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var result = featureAbility.startAbility( + { + want: + { + action: "action.system.homeability", + entities: ["entity.system.home"], + type: "MIMETYPE", + options: { + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "" + }, + parameters: + { + mykey0: 1111, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "xxxxxxxxxxxxxxxxxxxxxx", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], + mykey7: true, + }, + }, + (error, data) => { + console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) + + }, + ); + }) + + /** + * @tc.number: ACTS_StartAbility_0600 + * @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + * @tc.desc: Passing null, Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_StartAbility_0600', 0, async function (done) { + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_0600_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0600).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_0600=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var result = featureAbility.startAbility( + { + want: + { + action: "", + entities: [""], + type: "", + options: { + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + uri: "" + }, + }, + (error, data) => { + console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) + + }, + ); + }) + + /** + * @tc.number: ACTS_TerminateAbility_0200 + * @tc.name: TerminateAbility : Destroys ability + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_TerminateAbility_0200', 0, async function (done) { + var Subscriber; + let id; + let events = new Map(); + + function SubscribeCallBack(err, data) { + clearTimeout(id); + events.set(data.event, 0); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + if (events.size > 1) { + expect(events.has("ACTS_TerminateAbility_0200_CommonEvent") && + events.has("ACTS_TerminateAbility_0200_Return")).assertTrue(); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } else { + expect(events.has("ACTS_TerminateAbility_0200_CommonEvent") || + events.has("ACTS_TerminateAbility_0200_Return")).assertTrue(); + } + } + + commonEvent.createSubscriber(subscriberInfoTerminateAbilityTwo).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_TerminateAbility_0200=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + console.log('=====start ability====='); + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var promise = featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + flags: 2, + deviceId: "", + bundleName: "com.example.terminateabilitytest", + abilityName: "com.example.terminateabilitytest.MainAbility", + uri: "" + }, + } + ); + expect(typeof (promise)).assertEqual("object"); + }) + + // checkAbilityName + function checkAbilityName(info) { + console.log("AbilityName name : " + info); + expect(typeof (info)).assertEqual("string"); + expect(info).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); + } + + /** + * @tc.number: ACTS_GetAbilityName_0100 + * @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name. + * @tc.desc: Check the return type of the interface (by Promise) + */ + it('ACTS_GetAbilityName_0100', 0, async function (done) { + var promise = featureAbility.getAbilityName(); + expect(typeof (promise)).assertEqual("object"); + var info = await featureAbility.getAbilityName(); + checkAbilityName(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetAbilityName_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetAbilityName_0200 + * @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name. + * @tc.desc: Check the return type of the interface (by AsyncCallback) + */ + it('ACTS_GetAbilityName_0200', 0, async function (done) { + var result = featureAbility.getAbilityName( + (err, data) => { + checkAbilityName(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetAbilityName_0200 =====>') + }, TIMEOUT) + }) + + // checkApplicationInfo + function checkApplicationInfo(info) { + console.log("getApplicationInfo : " + info) + console.log("name : " + info.name); + console.log("description : " + info.description); + console.log("descriptionId : " + info.descriptionId); + console.log("systemApp : " + info.systemApp); + console.log("enabled : " + info.enabled); + console.log("label : " + info.label); + console.log("labelId : " + info.labelId); + console.log("icon : " + info.icon); + console.log("iconId : " + info.iconId); + console.log("process : " + info.process); + console.log("supportedModes : " + info.supportedModes); + + console.log("moduleSourceDirs length : " + info.moduleSourceDirs.length); + for (var j = 0; j < info.moduleSourceDirs.length; j++) { + console.log("info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]); + } + console.log("permissions length : " + info.permissions.length); + for (var j = 0; j < info.permissions.length; j++) { + console.log("info.permissions[" + j + "] : " + info.permissions[j]); + } + console.log("moduleInfos length : " + info.moduleInfos.length); + for (var j = 0; j < info.moduleInfos.length; j++) { + console.log("info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName); + console.log("info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir); + } + console.log("entryDir : " + info.entryDir); + + expect(typeof (info)).assertEqual("object"); + expect(typeof (info.name)).assertEqual("string"); + expect(typeof (info.description)).assertEqual("string"); + expect(typeof (info.descriptionId)).assertEqual("number"); + expect(typeof (info.systemApp)).assertEqual("boolean"); + expect(typeof (info.enabled)).assertEqual("boolean"); + expect(typeof (info.label)).assertEqual("string"); + expect(typeof (info.labelId)).assertEqual("string"); + expect(typeof (info.icon)).assertEqual("string"); + expect(typeof (info.iconId)).assertEqual("string"); + expect(typeof (info.process)).assertEqual("string"); + expect(typeof (info.supportedModes)).assertEqual("number"); + expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); + expect(Array.isArray(info.permissions)).assertEqual(true); + expect(Array.isArray(info.moduleInfos)).assertEqual(true); + expect(typeof (info.entryDir)).assertEqual("string"); + + expect(info.name).assertEqual("com.example.actsfeatureabilitytest"); + expect(info.description).assertEqual("$string:mainability_description"); + // expect(info.descriptionId).assertEqual(0); //create by DevEco when building HAP. + expect(info.systemApp).assertEqual(true); + expect(info.enabled).assertEqual(true); + expect(info.label).assertEqual("$string:app_name"); + // expect(info.labelId).assertEqual(0); //create by DevEco when building HAP. + expect(info.icon).assertEqual("$media:icon"); + // expect(info.iconId).assertEqual(0); //create by DevEco when building HAP. + expect(info.process).assertEqual("processTest"); + expect(info.supportedModes).assertEqual(0); + expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + + "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); + expect(info.moduleInfos[0].moduleName).assertEqual("entry"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); + expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + + "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); + } + + /** + * @tc.number: ACTS_GetApplicationInfo_0100 + * @tc.name: GetApplicationInfo : Obtains information about the current application. + * @tc.desc: Check the return type of the interface (by Promise) + */ + it('ACTS_GetApplicationInfo_0100', 0, async function (done) { + var context = featureAbility.getContext(); + var promise = context.getApplicationInfo(); + expect(typeof (promise)).assertEqual("object"); + var info = await context.getApplicationInfo(); + checkApplicationInfo(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetApplicationInfo_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetApplicationInfo_0200 + * @tc.name: GetApplicationInfo : Obtains information about the current application. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_GetApplicationInfo_0200', 0, async function (done) { + var context = featureAbility.getContext() + var result = context.getApplicationInfo( + (err, data) => { + checkApplicationInfo(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetApplicationInfo_0200 =====>') + }, TIMEOUT) + }) + + // checkProcessInfo + function checkProcessInfo(info) { + console.log("checkProcessInfo ProcessInfo: " + info); + console.log("checkProcessInfo processName : " + info.processName); + console.log("checkProcessInfo pid : " + info.pid); + + expect(typeof (info)).assertEqual("object"); + expect(typeof (info.processName)).assertEqual("string"); + expect(typeof (info.pid)).assertEqual("number"); + expect(info.processName).assertEqual("processTestAbility"); + } + + /** + * @tc.number: ACTS_GetProcessInfo_0100 + * @tc.name: GetProcessInfo : Called when getting the ProcessInfo + * @tc.desc: Check the return type of the interface (by promise) + */ + it('ACTS_GetProcessInfo_0100', 0, async function (done) { + var context = featureAbility.getContext() + var promise = context.getProcessInfo(); + expect(typeof (promise)).assertEqual("object"); + var info = await context.getProcessInfo(); + checkProcessInfo(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetProcessInfo_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetProcessInfo_0200 + * @tc.name: GetProcessInfo : Called when getting the ProcessInfo + * @tc.desc: Check the return type of the interface (by AsyncCallback) + */ + it('ACTS_GetProcessInfo_0200', 0, async function (done) { + var context = featureAbility.getContext() + var result = context.getProcessInfo( + (err, data) => { + checkProcessInfo(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetProcessInfo_0200 =====>') + }, TIMEOUT) + }) + + // checkElementName + function checkElementName(info) { + console.log("getElementName : " + info); + console.log("deviceId : " + info.deviceId); + console.log("bundleName : " + info.bundleName); + console.log("abilityName : " + info.abilityName); + console.log("uri : " + info.uri); + console.log("shortName : " + info.shortName); + + expect(typeof (info)).assertEqual("object"); + expect(typeof (info.deviceId)).assertEqual("string"); + expect(typeof (info.bundleName)).assertEqual("string"); + expect(typeof (info.abilityName)).assertEqual("string"); + expect(typeof (info.uri)).assertEqual("string"); + expect(typeof (info.shortName)).assertEqual("string"); + + expect(info.deviceId).assertEqual(""); + expect(info.bundleName).assertEqual("com.example.actsfeatureabilitytest"); + expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); + expect(info.uri).assertEqual(""); + expect(info.shortName).assertEqual(""); + } + + /** + * @tc.number: ACTS_GetElementName_0100 + * @tc.name: GetElementName : Obtains the ohos.bundle.ElementName object of the current ability. + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_GetElementName_0100', 0, async function (done) { + var context = featureAbility.getContext() + var promise = context.getElementName(); + expect(typeof (promise)).assertEqual("object"); + var info = await context.getElementName(); + checkElementName(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetElementName_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetElementName_0200 + * @tc.name: GetElementName : Obtains the ohos.bundle.ElementName object of the current ability. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_GetElementName_0200', 0, async function (done) { + var context = featureAbility.getContext() + var result = context.getElementName( + (err, data) => { + checkElementName(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetElementName_0200 =====>') + }, TIMEOUT) + }) + + // checkAppType + function checkAppType(info) { + console.log("AppType : " + info); + expect(typeof (info)).assertEqual("string"); + expect(info).assertEqual("system"); + } + + /** + * @tc.number: ACTS_GetAppType_0100 + * @tc.name: GetAppType : Obtains the type of this application. + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_GetAppType_0100', 0, async function (done) { + var promise = featureAbility.getAppType(); + expect(typeof (promise)).assertEqual("object"); + var info = await featureAbility.getAppType(); + checkAppType(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetAppType_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetAppType_0200 + * @tc.name: GetAppType : Obtains the type of this application. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_GetAppType_0200', 0, async function (done) { + var result = featureAbility.getAppType( + (err, data) => { + checkAppType(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetAppType_0200 =====>') + }, TIMEOUT) + }) + + // checkAbilityInfo + function checkAbilityInfo(data) { + console.log("checkAbilityInfo start " + data); + console.log("checkAbilityInfo bundleName : " + data.bundleName); + console.log("checkAbilityInfo name : " + data.name); + console.log("checkAbilityInfo label : " + data.label); + console.log("checkAbilityInfo description : " + data.description); + console.log("checkAbilityInfo icon : " + data.icon); + console.log("checkAbilityInfo labelId : " + data.labelId); + console.log("checkAbilityInfo descriptionId : " + data.descriptionId); + console.log("checkAbilityInfo iconId : " + data.iconId); + console.log("checkAbilityInfo moduleName : " + data.moduleName); + console.log("checkAbilityInfo process : " + data.process); + console.log("checkAbilityInfo isVisible : " + data.isVisible); + console.log("checkAbilityInfo type : " + data.type) + console.log("checkAbilityInfo orientation : " + data.orientation); + console.log("checkAbilityInfo launchMode : " + data.launchMode); + console.log("checkAbilityInfo uri : " + data.uri); + console.log("checkAbilityInfo promise readPermission : " + data.readPermission); + console.log("checkAbilityInfo writePermission : " + data.writePermission); + console.log("checkAbilityInfo formEntity : " + data.formEntity); + console.log("checkAbilityInfo minFormHeight : " + data.minFormHeight); + console.log("checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); + console.log("checkAbilityInfo minFormWidth : " + data.minFormWidth); + console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth); + console.log("checkAbilityInfo targetAbility : " + data.targetAbility); + console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes); + console.log("checkAbilityInfo subType : " + data.subType); + console.log("checkAbilityInfo formEnabled : " + data.formEnabled); + + console.log("checkAbilityInfo permissions length : " + data.permissions.length); + for (var j = 0; j < data.permissions.length; j++) { + console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); + } + console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); + for (var j = 0; j < data.deviceTypes.length; j++) { + console.log("getAbilityInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); + } + console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); + for (var j = 0; j < data.deviceCapabilities.length; j++) { + console.log("getAbilityInfo data.deviceCapabilities[" + j + "] : " + data.deviceCapabilities[j]); + } + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.bundleName)).assertEqual("string"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("number"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.iconId)).assertEqual("number"); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.process)).assertEqual("string"); + expect(typeof (data.targetAbility)).assertEqual("string"); + expect(typeof (data.backgroundModes)).assertEqual("number"); + expect(typeof (data.isVisible)).assertEqual("boolean"); + expect(typeof (data.formEnabled)).assertEqual("boolean"); + expect(typeof (data.type)).assertEqual("number"); + expect(typeof (data.subType)).assertEqual("number"); + expect(typeof (data.orientation)).assertEqual("number"); + expect(typeof (data.launchMode)).assertEqual("number"); + expect(Array.isArray(data.permissions)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); + expect(typeof (data.readPermission)).assertEqual("string"); + expect(typeof (data.writePermission)).assertEqual("string"); + expect(typeof (data.applicationInfo)).assertEqual("object"); + expect(typeof (data.formEntity)).assertEqual("number"); + expect(typeof (data.minFormHeight)).assertEqual("number"); + expect(typeof (data.defaultFormHeight)).assertEqual("number"); + expect(typeof (data.minFormWidth)).assertEqual("number"); + expect(typeof (data.defaultFormWidth)).assertEqual("number"); + expect(typeof (data.uri)).assertEqual("string"); + + + expect(data.bundleName).assertEqual("com.example.actsfeatureabilitytest"); + expect(data.name).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); + expect(data.label).assertEqual("$string:app_name"); + expect(data.description).assertEqual("$string:mainability_description"); + expect(data.icon).assertEqual("$media:icon"); + + expect(data.moduleName).assertEqual("entry"); + expect(data.process).assertEqual("processTestAbility"); + expect(data.targetAbility).assertEqual(""); + expect(data.backgroundModes).assertEqual(0); + expect(data.isVisible).assertEqual(true); + expect(data.formEnabled).assertEqual(false); + expect(data.type).assertEqual(1); + expect(data.subType).assertEqual(0); + expect(data.orientation).assertEqual(0); + expect(data.launchMode).assertEqual(0); + + expect(data.permissions[0]).assertEqual("ohos.permission.ACCELEROMETER"); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceCapabilities[0]).assertEqual("ability_base"); + expect(data.deviceCapabilities[1]).assertEqual("ability_runtime"); + + expect(data.readPermission).assertEqual(""); + expect(data.writePermission).assertEqual(""); + expect(data.formEntity).assertEqual(0); + expect(data.minFormHeight).assertEqual(0); + expect(data.defaultFormHeight).assertEqual(0); + expect(data.minFormWidth).assertEqual(0); + expect(data.defaultFormWidth).assertEqual(0); + expect(data.uri).assertEqual("uriTest"); + + console.log("checkAbilityInfo end " + data); + } + + /** + * @tc.number: ACTS_GetAbilityInfo_0100 + * @tc.name: GetAbilityInfo : Obtains the HapModuleInfo object of the application. + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_GetAbilityInfo_0100', 0, async function (done) { + var promise = featureAbility.getAbilityInfo(); + expect(typeof (promise)).assertEqual("object"); + + var info = await featureAbility.getAbilityInfo(); + checkAbilityInfo(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetAbilityInfo_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetAbilityInfo_0200 + * @tc.name: GetAbilityInfo : Obtains the HapModuleInfo object of the application. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_GetAbilityInfo_0200', 0, async function (done) { + var result = featureAbility.getAbilityInfo( + (err, data) => { + checkAbilityInfo(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetAbilityInfo_0200 =====>') + }, TIMEOUT) + }) + + // checkHapModuleInfo + function checkHapModuleInfo(data) { + console.log("checkHapModuleInfo start " + data); + console.log("checkHapModuleInfo name : " + data.name); + console.log("checkHapModuleInfo description : " + data.description); + console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); + console.log("checkHapModuleInfo icon : " + data.icon); + console.log("checkHapModuleInfo label : " + data.label); + console.log("checkHapModuleInfo labelId : " + data.labelId); + console.log("checkHapModuleInfo iconId : " + data.iconId); + console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg); + console.log("checkHapModuleInfo supportedModes : " + data.supportedModes); + console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); + for (var j = 0; j < data.reqCapabilities.length; j++) { + console.log("getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); + } + console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); + for (var j = 0; j < data.deviceTypes.length; j++) { + console.log("getHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); + } + console.log("checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length); + console.log("checkHapModuleInfo moduleName : " + data.moduleName); + console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); + console.log("checkHapModuleInfo installationFree : " + data.installationFree); + + expect(typeof (data)).assertEqual("object"); + expect(typeof (data.name)).assertEqual("string"); + expect(typeof (data.description)).assertEqual("string"); + expect(typeof (data.descriptionId)).assertEqual("number"); + expect(typeof (data.icon)).assertEqual("string"); + expect(typeof (data.label)).assertEqual("string"); + expect(typeof (data.labelId)).assertEqual("number"); + expect(typeof (data.iconId)).assertEqual("number"); + expect(typeof (data.backgroundImg)).assertEqual("string"); + expect(typeof (data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.reqCapabilities)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.abilityInfos)).assertEqual(true); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.mainAbilityName)).assertEqual("string"); + expect(typeof (data.installationFree)).assertEqual("boolean"); + + expect(data.name).assertEqual("com.example.actsfeatureabilitytest"); + expect(data.description).assertEqual("descriptionTest"); + expect(data.descriptionId).assertEqual(0); + expect(data.icon).assertEqual("$media:icon"); + expect(data.label).assertEqual("$string:app_name"); + expect(data.labelId).assertEqual(0); + expect(data.iconId).assertEqual(0); + expect(data.backgroundImg).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + + expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); + expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.moduleName).assertEqual("entry") + expect(data.mainAbilityName).assertEqual(""); + expect(data.installationFree).assertEqual(false); + + console.log("checkHapModuleInfo end " + data); + } + + /** + * @tc.number: ACTS_GetHapModuleInfo_0100 + * @tc.name: GetHapModuleInfo : Obtains the HapModuleInfo object of the application. + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_GetHapModuleInfo_0100', 0, async function (done) { + var promise = featureAbility.getHapModuleInfo(); + expect(typeof (promise)).assertEqual("object"); + var info = await featureAbility.getHapModuleInfo(); + checkHapModuleInfo(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetHapModuleInfo_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetHapModuleInfo_0200 + * @tc.name: GetHapModuleInfo : Obtains the HapModuleInfo object of the application. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_GetHapModuleInfo_0200', 0, async function (done) { + var result = featureAbility.getHapModuleInfo( + (err, data) => { + checkHapModuleInfo(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetHapModuleInfo_0200 =====>') + }, TIMEOUT) + }) + + // checkProcessName + function checkProcessName(info) { + console.log("checkProcessName processName : " + info); + expect(typeof (info)).assertEqual("string"); + expect(info).assertEqual("processTestAbility"); + } + + /** + * @tc.number: ACTS_GetProcessName_0100 + * @tc.name: GetProcessName : Obtains the name of the current process. + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_GetProcessName_0100', 0, async function (done) { + var context = featureAbility.getContext(); + var promise = context.getProcessName(); + expect(typeof (promise)).assertEqual("object"); + var info = await context.getProcessName(); + checkProcessName(info); + done(); + setTimeout(function () { + console.info('====> ACTS_GetProcessName_0100 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetProcessName_0200 + * @tc.name: GetProcessName : Obtains the name of the current process. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_GetProcessName_0200', 0, async function (done) { + var context = featureAbility.getContext(); + var result = context.getProcessName( + (err, data) => { + checkProcessName(data); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetProcessName_0200 =====>') + }, TIMEOUT) + }) + + /** + * @tc.number: ACTS_GetCallingBundle_0100 + * @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability. + * @tc.desc: Check the return type of the interface (by AsyncCallback) + */ + it('ACTS_GetCallingBundle_0100', 0, async function (done) { + var Subscriber; + let id; + let events = new Map(); + + function SubscribeCallBack(err, data) { + clearTimeout(id); + events.set(data.event, 0) + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + if (events.size == 1) { + expect(events.has("ACTS_GetCallingBundle_0100_CommonEvent") || + events.has("com.example.actsfeatureabilitytest.promise") || + events.has("com.example.actsfeatureabilitytest.callback")).assertTrue(); + } else if (events.size == 2) { + expect(events.has("com.example.actsfeatureabilitytest.promise") || + events.has("com.example.actsfeatureabilitytest.callback")).assertTrue(); + } else if (events.size == 3) { + expect(events.has("ACTS_GetCallingBundle_0100_CommonEvent") && + events.has("com.example.actsfeatureabilitytest.promise") && + events.has("com.example.actsfeatureabilitytest.callback")).assertTrue(); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + } + + commonEvent.createSubscriber(subscriberInfo_ACTS_GetCallingBundle_0100).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_GetCallingBundle_0100=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + var result = await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.getcallingbundlepromisetest", + abilityName: "com.example.getcallingbundlepromisetest.MainAbility", + }, + } + ); + }) + + // @tc.number: ACTS_GetOrCreateLocalDir_0100 + // @tc.name: GetProcessName : Obtains the name of the current process. + // @tc.desc: Check the return value of the interface (by promise) + it('ACTS_GetOrCreateLocalDir_0100', 0, async function (done) { + var context = featureAbility.getContext(); + var promise = context.getOrCreateLocalDir(); + expect(typeof (promise)).assertEqual("object"); + var info = await context.getOrCreateLocalDir(); + expect(info).assertEqual(CREATELOCALDIR); + done(); + setTimeout(function () { + console.info('====> ACTS_GetOrCreateLocalDir_0100 =====>') + }, TIMEOUT) + }) + + // @tc.number: ACTS_GetOrCreateLocalDir_0200 + // @tc.name: GetProcessName : Obtains the name of the current process. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetOrCreateLocalDir_0200', 0, async function (done) { + var context = featureAbility.getContext(); + var result = context.getOrCreateLocalDir( + (err, data) => { + expect(data).assertEqual(CREATELOCALDIR); + done() + } + ); + setTimeout(function () { + console.info('====> ACTS_GetOrCreateLocalDir_0200 =====>') + }, TIMEOUT) + }) + + /* + * @tc.number ACTS_StartAbility_0700 + * @tc.name Configures the wrong abilityname validation + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_0700",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_0700-------------------"); + try{ + let Want = { + deviceId: '', + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbilityXXXXX", + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_0700 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + expect(err.code == 2097152).assertTrue(); + done(); + }); + }catch(error){ + console.log("ACTS_StartAbility_0700 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_0800 + * @tc.name Misconfigured bundlename validation + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_0800",0, async function(done){ + console.info("------------------logMessage startAbilityTest_0300-------------------"); + try{ + let Want = { + deviceId: '', + bundleName: "com.example.startabilityxxxxx", + abilityName: "com.example.startability.MainAbility", + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_0800 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + expect(err.code != 0).assertTrue(); + done(); + }); + }catch(error){ + console.log("ACTS_StartAbility_0800 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_0900 + * @tc.name Misconfigured deviceid validation + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_0900",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_0900-------------------"); + try{ + let Want = { + deviceId: "43026cb4ca40ce10101834d72731dc8509be1906d30e8d42e86886d2791e82xx", + bundleName: "com.example.startability", + abilityName: "com.example.startability.MainAbility", + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_0900 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data) + "err.code: " + err.code); + expect(err.code != 0).assertTrue(); + done(); + }); + }catch(error){ + console.log("ACTS_StartAbility_0900 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_1100 + * @tc.name Verify the ability of implicitly starting through action without configuring action + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1100",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1100-------------------"); + try{ + let Want = { + action: "action.sysxxxtem.homexxxx" + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_1100 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + expect(err.code != 0).assertTrue(); + done(); + }); + }catch(error){ + console.log("ACTS_StartAbility_1100 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_1200 + * @tc.name Verify that the ability without configured entities is started through action and entities + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1200",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1200-------------------"); + try{ + let Want = { + action: "action.system.home", + entities: ["entity.system.homexxxxxxxxx"] + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_1200 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + expect(err.code != 0).assertTrue(); + done(); + }); + }catch(error){ + console.log("ACTS_StartAbility_1200 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_1300 + * @tc.name Start ability through action and entities. Entities is configured as an empty array + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1300",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1300-------------------"); + try{ + var Subscriber; + let id; + + function SubscribeCallBack(err, data) { + clearTimeout(id); + expect(data.event).assertEqual("ACTS_StartAbility_1300_CommonEvent"); + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + done(); + } + + commonEvent.createSubscriber(subscriberInfoStartAbilityThirteen).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + + function timeout() { + expect().assertFail(); + console.debug('ACTS_StartAbility_1300=====timeout======'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + let Want = { + action: "action.system.homeability", + entities: [] + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_1300 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + expect(err.code == 0).assertTrue(); + }); + }catch(error){ + console.log("ACTS_StartAbility_1300 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_1400 + * @tc.name Start ability through action and entities, which are configured as strings + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1400",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1400-------------------"); + try{ + let Want = { + action: "action.system.home", + entities: 'asdfghj' + } + var StartAbilityParameter = { + want:Want + } + + featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ + console.log('ACTS_StartAbility_1400 asyncCallback errCode : ' + JSON.stringify(err) + + " data: " + JSON.stringify(data)); + done(); + }); + }catch(error){ + console.log("ACTS_StartAbility_1400 : error = " + error); + } + }); + + /* + * @tc.number ACTS_StartAbility_1600 + * @tc.name Startability input parameter want is {} + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1600",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1600-------------------"); + let Want = {} + var StartAbilityParameter = { + want:Want + } + + var promise = featureAbility.startAbility(StartAbilityParameter); + if (promise) { + promise.then((data) => { + console.log('ACTS_StartAbility_1600 errCode : ' + " data: " + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch((err)=>{ + expect(err.code != 0).assertTrue(); + done(); + }); + } else { + expect(promise == undefined).assertTrue(); + done(); + } + }); + + /* + * @tc.number ACTS_StartAbility_1700 + * @tc.name The startability input parameter is not configured with want + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1700",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1700-------------------"); + var StartAbilityParameter = {} + var promise = featureAbility.startAbility(StartAbilityParameter) + if (promise) { + promise.then((data) => { + console.log('ACTS_StartAbility_1700 data: ' + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch((err)=>{ + expect(err.code != 0).assertTrue(); + done(); + }); + } else { + expect(promise == undefined).assertTrue(); + done(); + } + }); + + /* + * @tc.number ACTS_StartAbility_1800 + * @tc.name The startability input parameter is undefined + * @tc.desc Function test + * @tc.level 0 + */ + it("ACTS_StartAbility_1800",0, async function(done){ + console.info("------------------logMessage ACTS_StartAbility_1800-------------------"); + var promise = featureAbility.startAbility(undefined); + if (promise) { + promise.then((data) => { + console.log('ACTS_StartAbility_1800 asyncCallback data: ' + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch((err)=>{ + expect(err.code != 0).assertTrue(); + done(); + }); + } else { + expect(promise == undefined).assertTrue(); + done(); + } + }); +}) diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dcdf3a43437009c0b047d0eb049ce8d616982e2c --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/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('./FeatureAbilityJsunit.test.js') +require('./StartAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/Test.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/Test.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..eff19b0efe4b160c0c66ccaef41dd9a1a6efa859 --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "finishwithresultemptytest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/Test.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/Test.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9070c7f7022960e0c5d30d208272d78d274e3ab5 --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "finishwithresultpromiseparameterstest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultemptytest/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/Test.json b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/Test.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e3c30196a5c1b15d906afcf20485815a1879036a --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "finishwithresulttest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/Test.json b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/Test.json rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..973b7e0bb4942b64c21f1c10ee1c7c5907f6261c --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "getcallingbundletest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/finishwithresulttest/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/startability/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/startability/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/Test.json b/ability/ability_runtime/featureability/sceneproject/startability/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/Test.json rename to ability/ability_runtime/featureability/sceneproject/startability/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/startability/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/startability/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/startability/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..58a3bc2550d1ae6f0e0245a81c03f424a0833881 --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "startability" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/startability/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/getcallingbundletest/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/startability/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/Test.json b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/Test.json rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d2748bbf68079a6277f1199706a40681693b44e0 --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "startabilityforresult" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startability/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/BUILD.gn rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/BUILD.gn diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/Test.json b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/Test.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/Test.json rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/Test.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/signature/openharmony_sx.p7b rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/config.json rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/config.json diff --git a/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/app.js b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4af6fce323d1c85d64076c37d72b39fd4c49719a --- /dev/null +++ b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "terminateabilitytest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/startabilityforresult/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/BUILD.gn b/ability/ability_runtime/formmanager/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/BUILD.gn rename to ability/ability_runtime/formmanager/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/BUILD.gn b/ability/ability_runtime/formmanager/fa/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f8328e9efeefab4b05dbe29a50a429d5c02586d3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/BUILD.gn @@ -0,0 +1,70 @@ +# 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("formmanager") { + testonly = true + if (is_standard_system) { + deps = [ + "formhostst_ets/formsystemhost:FormSystemHost", + "formhostst_ets/formsystemhostb:FormSystemHostB", + "formhostst_ets/formsystemhostc:FormSystemHostC", + "formhostst_ets/formsystemhostd:FormSystemHostD", + "formhostst_ets/formsystemhoste:FormSystemHostE", + "formhostst_ets/formsystemhostf:FormSystemHostF", + "formhostst_ets/formsystemhostg:FormSystemHostG", + "formhostst_ets/formsystemhosti:FormSystemHostI", + "formhostst_ets/formsystemhostj:FormSystemHostJ", + "formhostst_ets/formsystemhostk:FormSystemHostK", + "formhostst_ets/formsystemhostl:FormSystemHostL", + "formhostst_ets/formsystemhostn:FormSystemHostN", + "formhostst_ets/formsystemhostnoperm:FormSystemHostNoPerm", + "formhostst_ets/formsystemhosto:FormSystemHostO", + "formhostst_ets/formsystemhostp:FormSystemHostP", + "formproviderst_ets/formsupplyapplicationA:FormSupplyAppA", + "formproviderst_ets/formsupplyapplicationB:FormSupplyAppB", + "formproviderst_ets/formsupplyapplicationC:FormSupplyAppC", + "formproviderst_ets/formsupplyapplicationD:FormSupplyAppD", + "formproviderst_ets/formsupplyapplicationE:FormSupplyAppE", + "formproviderst_ets/formsupplyapplicationF:FormSupplyAppF", + "formproviderst_ets/formsupplyapplicationG:FormSupplyAppG", + "formproviderst_ets/formsupplyapplicationH:FormSupplyAppH", + "formproviderst_ets/formsupplyapplicationNotSysApp:FormSupplyAppNS", + "formproviderst_ets/formsystemprovidera:FormSystemProviderA", + "formproviderst_ets/formsystemproviderb:FormSystemProviderB", + "formproviderst_ets/formsystemproviderc:FormSystemProviderC", + "formproviderst_ets/formsystemproviderd:FormSystemProviderD", + "formsystemtest_ets/formacquiretest:ActsFormAcquireTest", + "formsystemtest_ets/formacquiretest2:ActsFormAcquire2Test", + "formsystemtest_ets/formdeletetest:ActsFormDeleteTest", + "formsystemtest_ets/formdynamicrefreshtest:ActsFormDynamicRefreshTest", + "formsystemtest_ets/formfuzztest:ActsFormFuzzTest", + "formsystemtest_ets/formgetformsinfotest/formsoneandonetest:ActsFormsOneAndOneTest", + "formsystemtest_ets/formgetformsinfotest/formsoneandtwotest:ActsFormsOneAndTwoTest", + "formsystemtest_ets/formgetformsinfotest/formsoneandzerotest:ActsFormsOneAndZeroTest", + "formsystemtest_ets/formgetformsinfotest/formswithoutpermtest:ActsFormsWithoutPermTest", + "formsystemtest_ets/formgetformsinfotest/formszerotest:ActsFormsZeroTest", + "formsystemtest_ets/formhostdeathrecipienttest:ActsFormHostDeathRecipientTest", + "formsystemtest_ets/formperformancetest:ActsFormPerformanceTest", + "formsystemtest_ets/formreleasetest:ActsFormReleaseTest", + "formsystemtest_ets/formstatetest_disable:ActsFormStateDisableTest", + "formsystemtest_ets/formstatetest_enable:ActsFormStateEnableTest", + "formsystemtest_ets/formstatetest_notifyinvisible:ActsFormStateNotifyInvisibleTest", + "formsystemtest_ets/formstatetest_notifyinvisible2:ActsFormStateNotifyInvisible2Test", + "formsystemtest_ets/formstatetest_notifyvisible:ActsFormStateNotifyVisibleTest", + "formsystemtest_ets/formstresstest:ActsFormStressTest", + "formsystemtest_ets/formupdatefreshtest:ActsFormUpdateRefreshTest", + ] + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4cdbaedb327bc51f3282ea81d8135eec31eaa9c3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,304 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private deleteForm = false; + private deleteId = "-1"; + private temporaryId = "-1"; + private temporary = false; + private castForm = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formOnUninstallEvent = "FMS_FormOnUninstall_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formCastEvent Publish CallBack ====>"); + } + + private publishOnUninstallCallBack() { + console.debug("====>formOnUninstallEvent Publish CallBack ====>"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); + if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { + return; + } + formHost.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhost deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + console.log("formsystemhost dimension1:" + this.dimension); + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + console.log("formsystemhost dimension2:" + this.dimension); + if (want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if (want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if (want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if (want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:' + this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end' + JSON.stringify(want)); + + if (!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhost deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhost deleteForm result:' + data); + let commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.log("formsystemhost deleteForm end"); + } + if (!want.parameters.isCreate && this.castForm) { + console.log("[FormComponent.host] castTempForm start"); + formHost.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.log("[FormComponent.host] castTempForm end"); + } + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if (this.castForm) { + console.log("[FormComponent.host] castTempForm start"); + formHost.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.formId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.log("[FormComponent.host] castTempForm end"); + } else if (this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if (this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + let commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + + console.log("[FormComponent.host] deleteForm end"); + }, 1000); + } else { + let commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onUninstall((info) => { + console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + let commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId": info.id.toString() + } + }; + commonEvent.publish(this.formOnUninstallEvent, commonEventPublishData, this.publishOnUninstallCallBack); + }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if (this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId": this.formId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/featureability/sceneproject/terminateabilitytest/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a53162bb5afe3bc80e9e4c834b7e38176ea06d1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,261 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private deleteForm = false; + private deleteId = "-1"; + private temporaryId="-1"; + private temporary = false; + private castForm = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + private subscriberDle; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formCastEvent Publish CallBack ====>"); + } + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); + if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostb") { + return; + } + formHost.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhost deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDle = data; + await commonEvent.subscribe(this.subscriberDle, this.deleteCallBack); + }) + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if(want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if(want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if(want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if(!this.dimension) { + this.dimension = FormDimension.Dimension_1_2; + } + if(want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if(want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if(want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if(want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end'+ JSON.stringify(want)); + + if(!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhostb deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhostb deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + + console.log("formsystemhostb deleteForm end"); + } + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if(this.castForm) { + console.log("[FormComponent.host] castTempForm start"); + formHost.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + + console.log("[FormComponent.host] castTempForm end"); + } else if(this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if(this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.log("[FormComponent.host] deleteForm end"); + }, 1000); + } else { + let commonEventPublishData = { + data: this.formId.toString() + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + // .onUninstall((info) => { + // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + // }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if(this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9037fff95ef276129e9368d1dc080cb4d838aba2 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostC") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostC" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..f07e7e2fa9031ba48a6fd0d4fe3d575bf8a34ae9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json @@ -0,0 +1,140 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostc", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostc", + "name": ".FormStHostAppC", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_TimeChange_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormCast_commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "name": "FMS_TimeChange_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6233d7ae5c80a8b01c360cb6fd7fd915e2a4b950 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostC" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..146fd62ef31f39bdd79e437c97176914165f048d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,333 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private releaseForm = false; + private releaseId = "-1"; + private deleteForm = false; + private deleteId = "-1"; + private temporaryId="-1"; + private temporary = false; + private castForm = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); + } + private publishOnDeletedCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); + } + private publishOnReleasedCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formsystemhostc formCastEventCallBack ====>"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); + if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostd") { + return; + } + formHost.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhost deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if(want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if(want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if(want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if(!this.dimension) { + this.dimension = FormDimension.Dimension_1_2; + } + if(want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if(want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if(want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if(want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + if(want.parameters.releaseForm) { + this.releaseForm = want.parameters.releaseForm; + } + if(want.parameters.releaseId) { + this.releaseId = want.parameters.releaseId; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end'+ JSON.stringify(want)); + + if(!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhost deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhost deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('formsystemhost deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("formsystemhost deleteForm end"); + } + + if(!want.parameters.isCreate && this.releaseForm) { + console.log("formsystemhost releaseForm start"); + formHost.releaseForm(this.releaseId) + .then((data) => { + console.info('formsystemhost releaseForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }) + .catch((error) => { + console.info('formsystemhost releaseForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }); + + console.log("formsystemhost releaseForm end"); + } + + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if(this.castForm) { + console.log("[FormComponent.host] castTempForm start"); + formHost.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.log("[FormComponent.host] castTempForm end"); + } else if(this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if(this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + var commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('formsystemhost deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("[FormComponent.host] deleteForm end"); + }, 1000); + } else if(this.releaseForm) { + console.log("[FormComponent.host] releaseForm start"); + if(this.releaseId == "self") { + this.releaseId = this.formId.toString(); + } + setTimeout(() => { + formHost.releaseForm(this.releaseId) + .then((data) => { + console.info('[FormComponent] releaseForm result:' + data); + let retData = "-1"; + if((data + "") == "0") { + retData = data + ""; + } + var commonEventPublishData = { + data: retData, + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }); + + console.log("[FormComponent.host] releaseForm end"); + }, 1000); + } else { + var commonEventPublishData = { + data: this.formId.toString() + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + // .onUninstall((info) => { + // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + // }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if(this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ff6d96e86a21bd572fd04545d452305a89cbd92 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,416 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from '@ohos.ability.featureAbility'; +import formHost from '@ohos.application.formHost'; +import formProvider from '@ohos.application.formProvider'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private requestForm = false; + private requestId = "-1"; + private refreshForm = false; + private refreshId = "-1"; + private refreshTime = 5; + private notifyVisibleForms = false; + private notifyVisibleId = "-1"; + private deleteForm = false; + private deleteId = "-1"; + private temporaryId = "-1"; + private temporary = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + private formOnDynamicRefreshEvent = "FMS_FormDynamicRefresh_commonEvent"; + private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); + } + private publishOnDeletedCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); + } + private formOnDynamicRefreshCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc formOnDynamicRefreshEventk ====>"); + } + private formOnRequestCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc formOnRequestCallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); + if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { + return; + } + formHost.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhost deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if (!this.dimension) { + this.dimension = FormDimension.Dimension_1_2; + } + if (want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if (want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if (want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + if (want.parameters.refreshForm) { + this.refreshForm = want.parameters.refreshForm; + } + if (want.parameters.refreshId) { + this.refreshId = want.parameters.refreshId; + } + if (want.parameters.refreshTime) { + this.refreshTime = want.parameters.refreshTime; + } + if (want.parameters.requestForm) { + this.requestForm = want.parameters.requestForm; + } + if (want.parameters.requestId) { + this.requestId = want.parameters.requestId; + } + if (want.parameters.notifyVisibleForms) { + this.notifyVisibleForms = want.parameters.notifyVisibleForms; + } + if (want.parameters.notifyVisibleId) { + this.notifyVisibleId = want.parameters.notifyVisibleId; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:' + this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end' + JSON.stringify(want)); + + if (!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhost deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhost deleteForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('formsystemhost deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("formsystemhost deleteForm end"); + } + if (!want.parameters.isCreate && this.refreshForm) { + console.log("formsystemhost refreshForm start"); + formProvider.setFormNextRefreshTime(this.refreshId, this.refreshTime) + .then((data) => { + console.info('formsystemhost refreshForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId": this.refreshId.toString() + } + }; + commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); + }) + .catch((error) => { + console.info('formsystemhost refreshForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.refreshId.toString() + } + }; + commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); + }); + + console.log("formsystemhost deleteForm end"); + } + if (!want.parameters.isCreate && this.requestForm) { + console.log("[FormComponent.host] requestForm start"); + formHost.requestForm(this.requestId) + .then((data) => { + console.info('[FormComponent] requestForm result:' + data); + var commonEventPublishData = { + data: "0", + parameters: { + "formId": this.requestId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); + }) + .catch((error) => { + console.info('[FormComponent] requestForm error:' + error.toString()); + var commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.requestId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); + }); + + console.log("[FormComponent.host] requestForm end"); + } + + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if (this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if (this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + var commonEventPublishData = { + data: "0", + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('formsystemhost deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("[FormComponent.host] deleteForm end"); + }, 1000); + } else if (this.requestForm) { + console.log("[FormComponent.host] requestForm start"); + if (this.requestId == "self") { + this.requestId = this.formId.toString(); + } + setTimeout(() => { + formHost.requestForm(this.requestId) + .then((data) => { + console.info('[FormComponent] requestForm result:' + data); + var delFormId = this.requestId; + if (this.requestId == "0" || this.requestId == "-1") { + delFormId = this.formId.toString(); + } + var commonEventPublishData = { + data: "0", + parameters: { + "formId": delFormId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); + }) + .catch((error) => { + console.info('[FormComponent] requestForm error:' + error); + var delFormId = this.requestId; + if (this.requestId == "0" || this.requestId == "-1") { + delFormId = this.formId.toString(); + } + var commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": delFormId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.formOnRequestCallBack); + }); + + console.log("[FormComponent.host] requestForm end"); + }, 1000); + } else if (this.refreshForm) { + console.log("formsystemhost refreshForm start"); + if (this.refreshId == "self") { + this.refreshId = this.formId.toString(); + } + setTimeout(() => { + formProvider.setFormNextRefreshTime(this.refreshId, this.refreshTime) + .then((data) => { + console.info('formsystemhost refreshForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId": this.refreshId.toString() + } + }; + commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); + }) + .catch((error) => { + console.info('formsystemhost refreshForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.refreshId.toString() + } + }; + commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); + }); + }, 1000); + } else if (this.notifyVisibleForms) { + console.log("formsystemhost notifyVisibleForms start"); + if (this.notifyVisibleId == "self") { + this.notifyVisibleId = this.formId.toString(); + } + setTimeout(() => { + formHost.notifyVisibleForms([this.notifyVisibleId]) + .then((data) => { + console.info('formsystemhost notifyVisibleForms result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId": this.notifyVisibleId.toString() + } + }; + }) + .catch((error) => { + console.info('formsystemhost notifyVisibleForms error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.notifyVisibleId.toString() + } + }; + }); + }, 1000); + } else { + var commonEventPublishData = { + data: this.formId.toString() + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onUninstall((info) => { + console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if (this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId": this.formId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9c7a98142f91bad2c8134254b80c5ab8e5f60ab6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostF") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostF" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9665ee652052437c69e227b5cee8984e1537e888 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json @@ -0,0 +1,132 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostf", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostf", + "name": ".FormStHostAppF", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormUpdateRefresh_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "name": "FMS_FormUpdateRefresh_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4581aaedcbf7ba19ce0e7bec776b95e1f6044e1f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,439 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from '@ohos.ability.featureAbility'; +import formBindingData from '@ohos.application.formBindingData'; +import formManager from '@ohos.application.formHost'; +import formProvider from '@ohos.application.formProvider'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private updateForm = false; + private updateId = "-1"; + private jsonEmpty = false; + private releaseForm = false; + private releaseId = "-1"; + private deleteForm = false; + private deleteId = "-1"; + private temporaryId="-1"; + private temporary = false; + + private isStartOtherApp = false; + private otherAppState = "visible"; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; + private formOnUpdatedEvent = "FMS_FormUpdateRefresh_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); + } + private publishOnDeletedCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); + } + private publishOnReleasedCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); + } + private publishOnUpdatedCallBack() { + this.canCreateForm = false; + console.debug("====>formsystemhostc publishOnUpdatedCallBack ====>"); + } + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); + if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostf") { + return; + } + formManager.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhost deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if(want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if(want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if(want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if(!this.dimension) { + this.dimension = FormDimension.Dimension_1_2; + } + if(want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if(want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if(want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + if(want.parameters.releaseForm) { + this.releaseForm = want.parameters.releaseForm; + } + if(want.parameters.releaseId) { + this.releaseId = want.parameters.releaseId; + } + if(want.parameters.updateForm) { + this.updateForm = want.parameters.updateForm; + } + if(want.parameters.updateId) { + this.updateId = want.parameters.updateId; + } + if(want.parameters.jsonEmpty) { + this.jsonEmpty = want.parameters.jsonEmpty; + } + if(want.parameters.isStartOtherApp) { + this.isStartOtherApp = true; + if(want.parameters.otherAppState) { + this.otherAppState = want.parameters.otherAppState; + } + } + + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end'+ JSON.stringify(want)); + + if(!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhost deleteForm start"); + formManager.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhost deleteForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('formsystemhost deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("formsystemhost deleteForm end"); + } + + if(!want.parameters.isCreate && this.releaseForm) { + console.log("formsystemhost releaseForm start"); + formManager.releaseForm(this.releaseId) + .then((data) => { + console.info('formsystemhost releaseForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }) + .catch((error) => { + console.info('formsystemhost releaseForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }); + + console.log("formsystemhost releaseForm end"); + } + + if(!want.parameters.isCreate && this.updateForm) { + console.log("formsystemhost updateForm start"); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + count: 10 + }; + if(this.jsonEmpty) { + formData = { + temperature: "", + time: "", + area: "", + epidemic: true, + count: 1 + }; + } + let bindingData = formBindingData.createFormBindingData(formData); + formProvider.updateForm(this.updateId, bindingData) + .then((data) => { + console.info('formsystemhost updateForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.updateId + } + }; + commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); + }) + .catch((error) => { + console.info('formsystemhost updateForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.updateId + } + }; + commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); + }); + + console.log("formsystemhost releaseForm end"); + } + + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if(this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if(this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formManager.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + var commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('formsystemhost deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + console.log("[FormComponent.host] deleteForm end"); + }, 500); + } else if(this.releaseForm) { + console.log("[FormComponent.host] releaseForm start"); + if(this.releaseId == "self") { + this.releaseId = this.formId.toString(); + } + setTimeout(() => { + formManager.releaseForm(this.releaseId) + .then((data) => { + console.info('[FormComponent] releaseForm result:' + data); + var commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }) + .catch((error) => { + console.info('formsystemhost releaseForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishOnReleasedCallBack); + }); + + console.log("[FormComponent.host] releaseForm end"); + }, 500); + } else if (this.updateForm) { + console.log("formsystemhost updateForm start"); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + count: 10 + }; + if(this.jsonEmpty) { + formData = { + temperature: "", + time: "", + area: "", + epidemic: true, + count: 1 + }; + } + let bindingData = formBindingData.createFormBindingData(formData); + formProvider.updateForm(this.updateId, bindingData) + .then((data) => { + console.info('formsystemhost updateForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.updateId + } + }; + commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); + }) + .catch((error) => { + console.info('formsystemhost updateForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.updateId + } + }; + commonEvent.publish(this.formOnUpdatedEvent, commonEventPublishData, this.publishOnUpdatedCallBack); + }); + + console.log("formsystemhost releaseForm end"); + } else if (this.isStartOtherApp) { + console.log("formsystemhost app G start"); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : this.otherAppState, + "stateIds" : [this.formId.toString()], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`formsystemhost featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`formsystemhost featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + } else { + var commonEventPublishData = { + data: this.formId.toString() + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + // .onUninstall((info) => { + // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + // }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if(this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f7a07615b0483b0c0f4636016634267fd1a9dafe --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostF" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c20baa75ef148f866d217a4b9d80a823eb41f226 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostG") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostG" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..1ef54c5fa2d9aa2c3b7eb7276b8e84628994fcce --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json @@ -0,0 +1,124 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostg", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostg", + "name": ".FormStHostAppG", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..29c50881b4fa14c77e09ceef9b06493392e8c034 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,502 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private stateForm = "visible"; + private doStateForm = false; + private stateIds = []; + private deleteForm = false; + private deleteId = "-1"; + private temporaryId="-1"; + private temporary = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + private formOnStateEvent = "FMS_FormOnState_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>[FormComponent.host] formOnErrorEventCallBack ====>"); + } + private publishOnDeletedCallBack() { + this.canCreateForm = false; + console.debug("====>[FormComponent.host] publishOnDeletedCallBack ====>"); + } + private publishOnStateCallBack() { + this.canCreateForm = false; + console.debug("====>[FormComponent.host] publishOnStateCallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>[FormComponent.host] formOnAcquiredEventCallBack ====>"); + } + private deleteCallBack(err, data) { + console.info("!!!====>[FormComponent.host] deleteCallBack start:====>" + JSON.stringify(data)); + if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostg") { + return; + } + formHost.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>[FormComponent.host] deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>[FormComponent.host] Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if(want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if(want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if(want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if(!this.dimension) { + this.dimension = FormDimension.Dimension_1_2; + } + if(want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if(want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if(want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + if(want.parameters.stateForm) { + this.stateForm = want.parameters.stateForm; + this.doStateForm = true; + } + if(want.parameters.stateIds) { + this.stateIds = want.parameters.stateIds; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end'+ JSON.stringify(want)); + + if(!want.parameters.isCreate && this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent.host] deleteForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.deleteId, + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId, + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("[FormComponent.host] deleteForm end"); + } + + if(!want.parameters.isCreate && this.stateForm) { + if(this.stateForm == "visible") { + console.log("[FormComponent.host] notifyVisibleForm start"); + formHost.notifyVisibleForms(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] notifyVisibleForm result:' + data); + console.info('[FormComponent.host] notifyVisibleForm formId:' + this.stateIds[0]); + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "visible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] notifyVisibleForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "visible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] notifyVisibleForm end"); + } else if(this.stateForm == "invisible") { + console.log("[FormComponent.host] notifyInvisibleForm start"); + formHost.notifyInvisibleForms(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] notifyInvisibleForm result:' + data); + console.info('[FormComponent.host] notifyInvisibleForm formId:' + this.stateIds[0]); + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "invisible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] notifyInvisibleForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "invisible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] notifyInvisibleForm end"); + } else if(this.stateForm == "enable") { + console.log("[FormComponent.host] enableFormsUpdate start"); + formHost.enableFormsUpdate(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] enableFormsUpdate result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "enable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] enableFormsUpdate error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "enable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] enableFormsUpdate end"); + } else { + console.log("[FormComponent.host] disableFormsUpdate start"); + formHost.disableFormsUpdate(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] disableFormsUpdate result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "disable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] disableFormsUpdate error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "disable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] disableFormsUpdate end"); + } + } + + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if(this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if(this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + let commonEventPublishData = { + data: "0", + parameters: { + "formId" : this.deleteId, + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + }); + + console.log("[FormComponent.host] deleteForm end"); + }, 500); + } else if(this.doStateForm) { + console.log("[FormComponent.host] state start"); + if((this.stateIds.length != 0) && (this.stateIds[0] == "self")) { + this.stateIds = [this.formId.toString()]; + } + console.info('[FormComponent.host] notifyVisibleForm stateIds:' + this.stateIds); + setTimeout(() => { + if(this.stateForm == "visible") { + console.log("[FormComponent.host] notifyVisibleForm start"); + formHost.notifyVisibleForms(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] notifyVisibleForm result:' + data); + console.info('[FormComponent.host] notifyVisibleForm formId:' + this.stateIds[0]); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "visible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] notifyVisibleForm error:' + error); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "visible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] notifyVisibleForm end"); + } else if(this.stateForm == "invisible") { + console.log("[FormComponent.host] notifyInvisibleForm start"); + formHost.notifyInvisibleForms(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] notifyInvisibleForm result:' + data); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + console.info('[FormComponent.host] notifyInvisibleForm formId:' + this.stateIds[0]); + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "invisible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] notifyInvisibleForm error:' + error.code); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "invisible", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] notifyInvisibleForm end"); + } else if(this.stateForm == "enable") { + console.log("[FormComponent.host] enableFormsUpdate start"); + formHost.enableFormsUpdate(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] enableFormsUpdate result:' + data); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "enable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] enableFormsUpdate error:' + error); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "enable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] enableFormsUpdate end"); + } else { + console.log("[FormComponent.host] disableFormsUpdate start"); + formHost.disableFormsUpdate(this.stateIds) + .then((data) => { + console.info('[FormComponent.host] disableFormsUpdate result:' + data); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: "0", + parameters: { + "kind": "disable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }) + .catch((error) => { + console.info('[FormComponent.host] disableFormsUpdate error:' + error); + if(this.stateIds.length == 0) { + this.stateIds = ["-1"]; + } + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "kind": "disable", + "formId" : this.stateIds[0] + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack); + }); + console.log("[FormComponent.host] disableFormsUpdate end"); + } + }, 1000); + } else { + let commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onUninstall((info) => { + console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if(this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishOnDeletedCallBack); + } else { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId" : "-1" + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..380d13176e786fceddc2a6de44c53defc326307e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostG" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c438bcde4a36ce97884e5f9f39bd7c64ebc10b5 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,290 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + private deleteForm = false; + private deleteId = "-1"; + private temporaryId = "-1"; + private temporary = false; + private castForm = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.info("====>formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.info("====>formOnAcquiredEvent Publish CallBack ====>"); + } + private publishCastCallBack() { + console.info("====>formCastEvent Publish CallBack ====>"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); + if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { + return; + } + formHost.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhost deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhost Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if (want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if (want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if (want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:' + this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end' + JSON.stringify(want)); + + if (!want.parameters.isCreate && this.deleteForm) { + console.info("formsystemhost deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhost deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.info("formsystemhost deleteForm end"); + } + if (!want.parameters.isCreate && this.castForm) { + console.info("[FormComponent.host] castTempForm start"); + formHost.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: data + "", + parameters: { + "formId": this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.info("[FormComponent.host] castTempForm end"); + } + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.info(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if (this.castForm) { + console.info("[FormComponent.host] castTempForm start"); + formHost.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: data + "", + parameters: { + "formId": this.formId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.info("[FormComponent.host] castTempForm end"); + } else if (this.deleteForm) { + console.info("[FormComponent.host] deleteForm start"); + if (this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + + console.info("[FormComponent.host] deleteForm end"); + }, 1000); + } else { + let commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId": this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onUninstall((info) => { + console.info("[FormComponent] onUninstall:" + JSON.stringify(info)); + }) + .onError((error) => { + console.info("[FormComponent.host] error code:" + error.errcode); + console.info("[FormComponent.host] error msg:" + error.msg); + if (this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId": this.formId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c610edc27fddeea49c9093b4b525a3146417225 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,290 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formManager from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private deleteForm = false; + private deleteId = "-1"; + private temporaryId="-1"; + private temporary = false; + private castForm = false; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private publishOnErrorCallBack() { + this.canCreateForm = false; + console.debug("====>formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formCastEvent Publish CallBack ====>"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>formsystemhostj deleteCallBack start:====>" + JSON.stringify(data)); + if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostj") { + return; + } + formManager.deleteForm(data.data) + .then((data2) => { + console.info('[FormComponent] deleteForm result:' + data2); + }); + + this.canCreateForm = false; + console.info("!!!====>formsystemhostj deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>formsystemhostj Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + await commonEvent.subscribe(this.subscriberDel, this.deleteCallBack); + }) + + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + this.moduleName = want.parameters.moduleName; + if(want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + console.log("formsystemhostj dimension1:" + this.dimension); + if(want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + console.log("formsystemhostj dimension2:" + this.dimension); + if(want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if(want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if(want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if(want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end'+ JSON.stringify(want)); + + if(!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhostj deleteForm start"); + formManager.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhostj deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.log("formsystemhostj deleteForm end"); + } + if(!want.parameters.isCreate && this.castForm) { + console.log("[FormComponent.host] castTempForm start"); + formManager.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.log("[FormComponent.host] castTempForm end"); + } + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + this.formId = form.id; + if(this.castForm) { + console.log("[FormComponent.host] castTempForm start"); + formManager.castTempForm(this.temporaryId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + setTimeout(() => { + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error); + setTimeout(() => { + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.temporaryId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }, 5); + }); + console.log("[FormComponent.host] castTempForm end"); + } else if(this.deleteForm) { + console.log("[FormComponent.host] deleteForm start"); + if(this.deleteId == "self") { + this.deleteId = this.formId.toString(); + } + setTimeout(() => { + formManager.deleteForm(this.deleteId) + .then((data) => { + console.info('[FormComponent] deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .catch((error) => { + console.info('[FormComponent] deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + + console.log("[FormComponent.host] deleteForm end"); + }, 1000); + } else { + let commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + // .onUninstall((info) => { + // console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + // }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + if(this.deleteForm && this.deleteId) { + let commonEventPublishData = { + data: error.msg, + parameters: { + "formId" : this.formId.toString() + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } else { + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + } + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..af31e1793fc454307b21a0ae4985b2b0da4b3c8d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostK") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostK" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4b25e4f0371b28e28bf2ee65f10eef061ee68adc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json @@ -0,0 +1,143 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostk", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostk", + "name": ".FormStHostAppK", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormTerminate_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnReleased_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormOnCast_commonEvent" + }, + { + "name": "FMS_FormTerminate_commonEvent" + }, + { + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + }, + { + "name": "fms.time_speed" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8de28109429d365f7c80d8aa5e329726f53c78a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.hostk] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.hostk] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..92ebdbbfb93c3aa69c8b97584409bd22ccdbc2ea --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,610 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import formHost from '@ohos.application.formHost'; +import commonEvent from '@ohos.commonEvent'; +import systemTime from '@ohos.systemTime'; + +// @ts-nocheck +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = `com.form.formsystemtestservicea.hmservice`; + @State ability: string = `com.form.formsystemtestservicea.hmservice.MainAbility`; + @State moduleName: string = `entry`; + @State name: string = `Form_Js001`; + @State canCreateForm: boolean = false; + @State allowUpdate: boolean = true; + @State isShowing: boolean = true; + @State dimension: FormDimension = FormDimension.Dimension_1_2; + @State temporary: boolean = false; + private requestForm = false; + private requestId = `-1`; + private temporaryId = `-1`; + private deleteForm = false; + private deleteId = `-1`; + private castTempForm = false; + private notifyVisibility = false; + private notifyVisibleForms = false; + private notifyInvisibleForms = false; + private releaseForm = false; + private releaseId = "-1"; + private update = false; + private enableUpdate = false; + private disableUpdate = false; + private isVisible = false; + private castForm = false; + private tempFormId = 0; + private createTempAndNormal = false; + private tempParam = {}; + private createSecondForm = false; + private secondParam = {}; + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"] + }; + private subscriberFormTerminateEvent = { + events: ["FMS_FormTerminate_commonEvent"] + }; + private TAG = `[FormComponent.hostk]`; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; + + private onAcquiredCallback() { + console.info(`${this.TAG} onAcquiredCallback`); + } + + private onRequestCallback() { + console.info(`====>${this.TAG} onRequestCallback====>`); + } + + private onDeletedCallback() { + console.info(`${this.TAG} onDeletedCallback`); + } + + private onReleasedCallback() { + console.info(`====>${this.TAG} onReleasedCallback====>`); + } + + private unsubscribeDeleteCallback() { + console.info(`${this.TAG} unSubscribeDeleteCallback`); + } + + private async aboutToAppear() { + const onDeleteEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormDeleteEvent); + const onTerminateEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormTerminateEvent); + commonEvent.subscribe(onDeleteEventSubscriber, async (err, data) => { + const formIds = data.parameters.formIds; + console.info(`${this.TAG} deleteCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${this.TAG} deleteCallback formIds: ${JSON.stringify(formIds)}`); + + commonEvent.unsubscribe(onDeleteEventSubscriber, () => this.unsubscribeDeleteCallback()); + let deletedFormAmount = 0; + if (formIds.length == 0) { + return; + } + formIds.forEach(async (formId, index) => { + try { + const res = await formHost.deleteForm(formId); + ++deletedFormAmount; + console.info(`${this.TAG} deleteForm${index} result: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${this.TAG} deleteForm${index} error: ${JSON.stringify(error)}`); + } + + if (index >= formIds.length - 1) { + const commonEventPublishData = { + parameters: { + deletedFormAmount: deletedFormAmount, + formIds: [].concat(data.parameters.formIds) + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, () => this.onDeletedCallback()); + console.info(`${this.TAG} deleteCallback end, deletedFormAmount ${deletedFormAmount}`); + } + }); + }); + + featureAbility.getWant() + .then(async (want: any) => { + console.info(`${this.TAG} ===> getWant: ${JSON.stringify(want)}`); + this.formId = want.parameters.formId; + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if (want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if (want.parameters.temporaryId) { + this.temporaryId = want.parameters.temporaryId; + } + if (want.parameters.requestForm) { + this.requestForm = want.parameters.requestForm; + } + if (want.parameters.requestId) { + this.requestId = want.parameters.requestId; + } + if (want.parameters.createSecondForm) { + this.createSecondForm = want.parameters.createSecondForm; + this.secondParam = want.parameters.secondParam; + console.info(`====onRequestCallback123====>` + JSON.stringify(want.parameters.secondParam)); + } + if (want.parameters.createTempAndNormal) { + this.createTempAndNormal = want.parameters.createTempAndNormal; + this.tempParam = want.parameters.tempParam; + } + if (want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if (want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + if (want.parameters.castTempForm) { + this.castTempForm = want.parameters.castTempForm; + } + if (want.parameters.notifyVisibility) { + this.notifyVisibility = want.parameters.notifyVisibility; + } + if (want.parameters.notifyVisibleForms) { + this.notifyVisibleForms = want.parameters.notifyVisibleForms; + } + if (want.parameters.notifyInvisibleForms) { + this.notifyInvisibleForms = want.parameters.notifyInvisibleForms; + } + if (want.parameters.releaseForm) { + this.releaseForm = want.parameters.releaseForm; + } + if (want.parameters.releaseId) { + this.releaseId = want.parameters.releaseId; + } + if (want.parameters.update) { + this.update = want.parameters.update; + } + if (want.parameters.enableUpdate) { + this.enableUpdate = want.parameters.enableUpdate; + } + if (want.parameters.disableUpdate) { + this.disableUpdate = want.parameters.disableUpdate; + } + if (want.parameters.subscribeTerminate) { + commonEvent.subscribe(onTerminateEventSubscriber, async (err, data) => { + console.info(`${this.TAG} onTerminateCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + commonEvent.unsubscribe(onTerminateEventSubscriber, () => { }); + console.info(`${this.TAG} onTerminateCallback end`); + setTimeout(async () => { + // terminate self + featureAbility.terminateSelf(); + console.info(`${this.TAG} featureAbility.terminateSelf`); + }, 1000); + }); + } + if (want.parameters.isCreate) { + this.canCreateForm = want.parameters.isCreate; + } + + if (!want.parameters.isCreate && this.deleteForm) { + console.log(`${this.TAG} deleteForm start`); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info(`${this.TAG} deleteForm result: ${JSON.stringify(data)}`); + let commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.deleteId + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.onDeletedCallback); + }) + .catch((error) => { + console.info(`${this.TAG} deleteForm error: ${JSON.stringify(error)}`); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.deleteId + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.onDeletedCallback); + }); + } + + if (!want.parameters.isCreate && this.releaseForm) { + console.log(`${this.TAG} releaseForm start`); + formHost.releaseForm(this.releaseId, true) + .then((data) => { + console.info(`${this.TAG} releaseForm result: ${JSON.stringify(data)}`); + let commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.releaseId + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.onReleasedCallback); + }) + .catch((error) => { + console.info(`${this.TAG} releaseForm error: ${JSON.stringify(error)}`); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId": this.releaseId + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.onReleasedCallback); + }); + } + + if (!this.canCreateForm && this.requestForm) { + let commonEventPublishData; + formHost.requestForm(this.requestId) + .then((data) => { + console.info(`${this.TAG} requestForm result: ${JSON.stringify(data)}`); + commonEventPublishData = { + data: (data + "") || "0", + parameters: { + "formId": this.requestId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); + }) + .catch((error) => { + console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`); + commonEventPublishData = { + parameters: { + "error": error + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); + }); + } + }) + .catch((error: any) => { + console.error(`${this.TAG} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Column() { + Text(`form component test begin`) + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpdate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired(async (form) => { + const createdTime = await systemTime.getCurrentTime(); + this.formId = form.id; + console.info(`${this.TAG} get form, form id: ${form.id}`); + if (this.deleteForm) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.deleteForm(this.formId.toString()); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} deleteForm result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `deleteForm`, + formId: this.formId, + startTime: startTime, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} deleteForm error: ${JSON.stringify(error)}`); + } + } else if (this.castTempForm) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.castTempForm(this.formId.toString()); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} castTempForm result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `castTempForm`, + formId: this.formId, + startTime: startTime, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} castTempForm error: ${JSON.stringify(error)}`); + } + } else if (this.notifyVisibility) { + try { + let res = await formHost.notifyVisibleForms([this.formId.toString()]); + console.info(`${this.TAG} notifyVisibleForms result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `notifyVisibleForms`, + formId: this.formId, + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} notifyVisibleForms error: ${JSON.stringify(error)}`); + } + try { + let res = await formHost.notifyInvisibleForms([this.formId.toString()]); + console.info(`${this.TAG} notifyInvisibleForms result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `notifyInvisibleForms`, + formId: this.formId, + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} notifyInvisibleForms error: ${JSON.stringify(error)}`); + } + } else if (this.notifyVisibleForms) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.notifyVisibleForms([this.formId.toString()]); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} notifyVisibleForms result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `notifyVisibleForms`, + formId: this.formId, + startTime: startTime, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} notifyVisibleForms error: ${JSON.stringify(error)}`); + } + } else if (this.notifyInvisibleForms) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.notifyInvisibleForms([this.formId.toString()]); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} notifyInvisibleForms result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `notifyInvisibleForms`, + formId: this.formId, + startTime: startTime, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} notifyInvisibleForms error: ${JSON.stringify(error)}`); + } + } else if (this.requestForm) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.requestForm(this.formId.toString()); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} requestForm result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `request`, + formId: this.formId, + startTime: startTime, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`); + } + } else if (this.releaseForm) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.releaseForm(this.formId.toString()); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} releaseForm result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `release`, + formId: this.formId, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} releaseForm error: ${JSON.stringify(error)}`); + } + } else if (this.update) { + try { + let res = await formHost.enableFormsUpdate([this.formId.toString()]); + console.info(`${this.TAG} enableUpdate result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `enableUpdate`, + formId: this.formId, + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} enableUpdate error: ${JSON.stringify(error)}`); + } + try { + let res = await formHost.disableFormsUpdate([this.formId.toString()]); + console.info(`${this.TAG} disableUpdate result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `disableUpdate`, + formId: this.formId, + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} disableUpdate error: ${JSON.stringify(error)}`); + } + } else if (this.enableUpdate) { + try { + const startTime = await systemTime.getCurrentTime(); + let res = await formHost.enableFormsUpdate([this.formId.toString()]); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} enableUpdate result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `enableUpdate`, + formId: this.formId, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} enableUpdate error: ${JSON.stringify(error)}`); + } + } else if (this.disableUpdate) { + try { + const startTime = await systemTime.getCurrentTime(); + const res = await formHost.disableFormsUpdate([this.formId.toString()]); + const endTime = await systemTime.getCurrentTime(); + console.info(`${this.TAG} disableUpdate result: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: (res + "") || "0", + parameters: { + kind: `disableUpdate`, + formId: this.formId, + hostTime: endTime - startTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } catch (error) { + console.info(`${this.TAG} disableUpdate error: ${JSON.stringify(error)}`); + } + } else { + const commonEventPublishData = { + data: this.formId.toString(), + parameters: { + formId: this.formId.toString(), + time: createdTime + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + } + }) + .onUninstall((info) => { + console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); + const commonEventPublishData = { + parameters: { + formId: info.id.toString(), + kind: "onUninstall" + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + }) + .onError((error) => { + console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); + }) + } + if (this.createSecondForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpdate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(`${this.TAG} secondForm onAcquired, form id: ${form.id}`); + this.formId = form.id; + const commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId": this.formId.toString() + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + }) + .onUninstall((info) => { + console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); + }) + .onError((error) => { + console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); + }); + } + if (this.createTempAndNormal) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpdate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(`${this.TAG} castForm onAcquired, form id: ${form.id}`); + this.formId = form.id; + const commonEventPublishData = { + data: this.formId.toString(), + parameters: { + "formId": this.formId.toString(), + "cast": true, + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, () => this.onAcquiredCallback()); + }) + .onUninstall((info) => { + console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); + }) + .onError((error) => { + console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); + }); + } + } + .backgroundColor(Color.White) + + Text(`form component test end`); + } + .backgroundColor(Color.White) + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..48f8c7d1f67e9c1fabdf5fabe25ec66948c47860 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostK" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..4ffe8d9e81dcb4f95cb218cda89565d944a17d13 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostL") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostL" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d184b9ec9f1f96282caf4286da00d6438216cbb0 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json @@ -0,0 +1,118 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostl", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostl", + "name": ".FormStHostAppL", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnRequest_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..450e90173ce3fdc89367fca16ee3dd618c66cf15 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.hostl] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.hostl] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ffec1f6182deed7844ecacb92f446e0881ea180 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets @@ -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 commonEvent from '@ohos.commonEvent'; +import featureAbility from '@ohos.ability.featureAbility'; +import formHost from '@ohos.application.formHost'; + +// @ts-nocheck +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = `com.form.formsystemtestservicea.hmservice`; + @State ability: string = `com.form.formsystemtestservicea.hmservice.MainAbility`; + @State moduleName: string = `entry`; + @State name: string = `Form_Js001`; + @State canCreateForm: boolean = false; + @State allowUpdate: boolean = true; + @State isShowing: boolean = true; + @State dimension: FormDimension = FormDimension.Dimension_1_2; + @State temporary: boolean = false; + private requestForm = false; + private requestId = `-1`; + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"] + }; + private TAG = `[FormComponent.hostl]`; + private formOnAcquiredEvent = `FMS_FormOnAcquired_commonEvent`; + private formOnRequestEvent = `FMS_FormOnRequest_commonEvent`; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + + private onAcquiredCallback() { + console.info(`====>${this.TAG} onAcquiredCallback====>`); + } + + private onRequestCallback() { + console.info(`====>${this.TAG} onRequestCallback====>`); + } + + private unsubscribeDeleteCallback() { + console.info(`${this.TAG} unSubscribeDeleteCallback====>`); + } + + private async aboutToAppear() { + const onDeleteEventSubscriber = await commonEvent.createSubscriber(this.subscriberFormDeleteEvent); + commonEvent.subscribe(onDeleteEventSubscriber, async (err, data) => { + console.info(`${this.TAG} deleteCallBack start:====> ${JSON.stringify(data)}`); + + data.parameters.formIds.forEach(async (formId) => { + await formHost.deleteForm(formId) + .then((res) => { + console.info(`${this.TAG} deleteForm result: ${JSON.stringify(res)}`); + }); + }); + + commonEvent.unsubscribe(onDeleteEventSubscriber, () => this.unsubscribeDeleteCallback()); + console.info(`${this.TAG} deleteCallBack end ====>`); + }); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.TAG} getWant: ${JSON.stringify(want)}`); + this.formId = want.parameters.formId; + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if (want.parameters.requestForm) { + this.requestForm = want.parameters.requestForm; + } + if (want.parameters.requestId) { + this.requestId = want.parameters.requestId; + } + if (want.parameters.isCreate) { + this.canCreateForm = want.parameters.isCreate; + } + + if (!this.canCreateForm && this.requestForm) { + let commonEventPublishData; + formHost.requestForm(this.requestId) + .then((data) => { + console.info(`${this.TAG} requestForm result: ${JSON.stringify(data)}`); + commonEventPublishData = { + data: data + "", + parameters: { + "formId": this.requestId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); + }) + .catch((error) => { + console.info(`${this.TAG} requestForm error: ${JSON.stringify(error)}`); + commonEventPublishData = { + parameters: { + "error": error + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.onRequestCallback); + }); + } + }) + .catch((error: any) => { + console.error(`${this.TAG} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Column() { + Text(`form component test begin`); + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpdate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(`${this.TAG} onAcquired, form id: ${form.id}`); + this.formId = form.id; + const commonEventPublishData = { + data: this.formId.toString() + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.onAcquiredCallback); + }) + .onUninstall((info) => { + console.info(`${this.TAG} onUninstall: ${JSON.stringify(info)}`); + }) + .onError((error) => { + console.error(`${this.TAG} onError: ${JSON.stringify(error)}`); + }); + } + } + .backgroundColor(Color.White) + + Text(`form component test end`); + } + .backgroundColor(Color.White) + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6b30c6c559be240c30e21e6b77e47da9eeb0d5b4 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostL" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..709984dca622557cdcf0ccdae01b8148e5c9a5b9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostN") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostN" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..6dca4226ce5e71a950efe771eb11b49d887eac72 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json @@ -0,0 +1,124 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostn", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostn", + "name": ".FormStHostAppN", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_SendCastForm_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormCast_commonEvent" + }, + { + "name": "FMS_SendCastForm_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b7da67abaf38532116e58733ad582cc60891306 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,455 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State optType: number = 0; + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private normal = 0; + private temporary = 0; + private normaldel = 0; + private temporarydel = 0; + private normalFormIds = []; + private tempFormIds = []; + + private deleteIds = []; + private delCount = 0; + + private normalFormCounts = []; + private tempFormCounts = []; + + private castFormId = "-1"; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private subscriberSendCastForm; + private subscriberSendCastFormEvent = { + events: ["FMS_SendCastForm_commonEvent"], + }; + + private publishOnErrorCallBack() { + console.debug("====> [FormComponent] formsystemhostn formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====> [FormComponent] formsystemhostn formOnAcquiredEvent Publish CallBack ====>"); + } + private publishDeleteCallBack() { + console.debug("====> [FormComponent] formsystemhostn publishDeleteCallBack Publish CallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formCastEvent Publish CallBack ====>"); + } + private startAbility(bundleName, abilityName, sendMsg) { + featureAbility.startAbility({ + want: { + bundleName: bundleName, + abilityName: abilityName, + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName": "entry", + "temporary": false, + "sendCastForm": true, + "sendCastFormMsg": sendMsg, + "isCreate": false + } + } + }).then((res: any) => { + console.info(`[FormComponent] formsystemhostn featureAbility.startAbility res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`[FormComponent] formsystemhostn featureAbility.startAbility error: ${JSON.stringify(err)}`); + }); + } + + private publishOnSendCastForm(err, data) { + console.info("!!!====>[FormComponent] formsystemhostn OnSendCastForm start:====>" + JSON.stringify(data)); + if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhostn") { + return; + } + let formId = data.parameters.castFormId; + setTimeout(function () { + console.info("[FormComponent.host] castTempForm start, formId: " + formId); + formHost.castTempForm(formId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", data); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); + this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", error.code.toString()); + }); + console.info("[FormComponent.host] castTempForm end"); + }, 5000); + console.info("!!!====>[FormComponent] formsystemhostn OnSendCastForm end"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>[FormComponent] formsystemhostn deleteCallBack start:====>" + JSON.stringify(data)); + const delFormIds = data.parameters.formIds; + console.info(`[FormComponent] data size ${delFormIds.length}`); + + console.info(`[FormComponent] data.subscriber ${JSON.stringify(this.subscriberDel)}`); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); + }); + console.info(`[FormComponent] data.bundleName ${JSON.stringify(data.bundleName)}`); + console.info(`[FormComponent] tof ${"com.ohos.st.formsystemhostn" != data.bundleName}`); + if ("com.ohos.st.formsystemhostn" != data.bundleName) { + return; + } + delFormIds.forEach(async (formId, index) => { + console.info(`[FormComponent] formsystemhostn deleteForm ${index}`); + try { + const res = await formHost.deleteForm(formId); + console.info(`[FormComponent] formsystemhostn deleteForm ${index} ${formId} result: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`[FormComponent] formsystemhostn deleteForm ${index} ${formId} error: ${JSON.stringify(error)}`); + } + }); + console.info("!!!====> [FormComponent] formsystemhostn optType deleteCallBack end ====>"); + } + + private unSubscribeDeleteCallback() { + console.debug("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); + } + + private unSubscribeCastFormCallback() { + console.debug("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>[FormComponent] formsystemhostn Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + commonEvent.subscribe(this.subscriberDel, (err, data) => { + if ("com.ohos.st.formsystemhostn" != data.bundleName) { + return; + } else { + console.info("!!!====>[FormComponent.hostn] formsystemhostn deleteCallBack start:====>" + JSON.stringify(data)); + const delFormIds = data.parameters.formIds; + console.info(`[FormComponent] data size ${delFormIds.length}`); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); + }); + let delCounter = 0; + delFormIds.forEach((formId) => { + formHost.deleteForm(formId, (error, data) => { + console.info(`[FormComponent] formsystemhostn deleteForm ${++delCounter} ${formId} data: ${JSON.stringify(data)} err: ${JSON.stringify(error)}`); + }); + }); + } + }); + }); + + commonEvent.createSubscriber(this.subscriberSendCastFormEvent).then(async (data) => { + console.info("====>[FormComponent] formsystemhostn Subscriber SendCastForm data:====>", JSON.stringify(data)); + this.subscriberSendCastForm = data; + await commonEvent.subscribe(this.subscriberSendCastForm, this.publishOnSendCastForm); + }); + + featureAbility.getWant() + .then(async (want: any) => { + console.info(" [FormComponent] formsystemhostn getWant:" + JSON.stringify(want)); + + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + + if (want.parameters.normal) { + this.normal = want.parameters.normal; + } + + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.normaldel) { + this.normaldel = want.parameters.normaldel; + } + + if (want.parameters.temporarydel) { + this.temporarydel = want.parameters.temporarydel; + } + + if (want.parameters.deleteIds) { + this.deleteIds = want.parameters.deleteIds; + } + if (want.parameters.castFormId) { + this.castFormId = want.parameters.castFormId; + } + + if (want.parameters.releaseFormId) { + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); + }); + + const formId = want.parameters.releaseFormId; + const isReleaseCache = want.parameters.isReleaseCache; + const res = await formHost.releaseForm(formId, isReleaseCache); + console.info(`[FormComponent] releaseForm res: ${JSON.stringify(res)}`); + const commonEventPublishData = { + data: `releaseForm`, + bundleName: `com.ohos.st.formsystemhostn`, + parameters: { + formIds: [].concat(formId) + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + + this.normal = 1; + } + + this.makeCount(); + + setTimeout(() => { + this.optType = want.parameters.optType; + console.info(' [FormComponent] formsystemhostn getWant optType:' + this.optType); + }, 10); + + if (this.castFormId != "-1" && want.parameters.optType == 3) { + console.info("[FormComponent.host] castTempForm start"); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostn optType unSubscribeCastFormCallback CallBack====>"); + }); + + formHost.castTempForm(this.castFormId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + let commonEventPublishData = { + data: (data + "") || `0`, + bundleName: "com.ohos.st.formsystemhostn", + parameters: { + formId: this.castFormId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + error.code); + let commonEventPublishData = { + data: error.code.toString(), + errMsg: error.msg, + bundleName: "com.ohos.st.formsystemhostn", + parameters: { + formId: this.castFormId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }); + console.info("[FormComponent.host] castTempForm end"); + } + + if (want.parameters.optType == 2 && this.deleteIds.length > 0) { + for (let iIndex = 0; iIndex < this.deleteIds.length; ++iIndex) { + console.info("[FormComponent] formsystemhostn deleteForm start"); + formHost.deleteForm(this.deleteIds[iIndex]) + .then((data) => { + console.info('[FormComponent] formsystemhostn deleteForm result:' + data); + this.delCount++; + + if (this.delCount == this.deleteIds.length) { + let commonEventPublishData = { + data: data + "", + bundleName: "com.ohos.st.formsystemhostn", + parameters: { + "formIds": this.deleteIds + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishDeleteCallBack); + } + }) + .catch((error) => { + console.info(' [FormComponent] formsystemhostn deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + bundleName: "com.ohos.st.formsystemhostn", + parameters: { + "formIds": [this.deleteIds[iIndex]] + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.info("[FormComponent] formsystemhostn deleteForm end"); + } + } + }) + .catch((error: any) => { + console.error(' [FormComponent] formsystemhostn Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.info(`[FormComponent.host] aboutToAppear end`); + } + + private makeCount() { + console.info(' [FormComponent] formsystemhostn makeCount start.'); + for (let nNormal = 0; nNormal < this.normal; nNormal++) { + this.normalFormCounts.push(nNormal); + } + console.info(' [FormComponent] formsystemhostn this.normalFormCounts.length:' + this.normalFormCounts.length); + + for (let nTemp = 0; nTemp < this.temporary; nTemp++) { + this.tempFormCounts.push(nTemp); + } + console.info(' [FormComponent] formsystemhostn this.tempFormCounts.length:' + this.tempFormCounts.length); + } + + build() { + Scroll(new Scroller()) { + Column() { + if (this.optType == 1) { + Text(' [FormComponent] formsystemhostn normal form component test begin') + Grid() { + ForEach(this.normalFormCounts, (item) => { + GridItem() { + FormComponent({ + id: 0, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: false + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(" [FormComponent] formsystemhostn get normal form, form id:" + form.id); + + this.normalFormIds.push(form.id.toString()); + if (this.normalFormIds.length == this.normal - this.normaldel) { + let commonEventPublishData = { + data: "normalForm", + bundleName: "com.ohos.st.formsystemhostn", + parameters: { + "formIds": this.normalFormIds + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onError((error) => { + console.info(" [FormComponent] formsystemhostn normal form error code:" + error.errcode); + console.info(" [FormComponent] formsystemhostn normal form error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg, + bundleName: "com.ohos.st.formsystemhostn" + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .size({ width: 40, height: 40 }) + } + }, (item) => JSON.stringify(item)) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') + .columnsGap(2) + .rowsGap(2) + .width('100%') + Text(' [FormComponent] formsystemhostn normal form component test end') + + Text(' [FormComponent] formsystemhostn temp form component test start') + Grid() { + ForEach(this.tempFormCounts, (item) => { + GridItem() { + FormComponent({ + id: 0, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: true + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(" [FormComponent] formsystemhostn get temp form, form id:" + form.id); + this.tempFormIds.push(form.id.toString()); + if (this.tempFormIds.length == this.temporary - this.temporarydel) { + let commonEventPublishData = { + data: "tempForm", + bundleName: "com.ohos.st.formsystemhostn", + parameters: { + "formIds": this.tempFormIds + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onError((error) => { + console.info(" [FormComponent] formsystemhostn temp form error code:" + error.errcode); + console.info(" [FormComponent] formsystemhostn temp form error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg, + bundleName: "com.ohos.st.formsystemhostn" + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .size({ width: 40, height: 40 }) + } + }, (item) => JSON.stringify(item)) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') + .columnsGap(2) + .rowsGap(2) + .width('100%') + + Text(' [FormComponent] formsystemhostn temp form component test end') + } + } + .backgroundColor(Color.White) + } + .scrollable(ScrollDirection.Vertical) + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4bdc0caf6a408397daf451336d990c7c52576d55 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostN" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..723d8885037f291d79ab9902904da6afc56645a9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostNoPerm") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostNoPerm" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..3e8c6d744837a0d161d8d31e1d59c37bbd2cbb07 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json @@ -0,0 +1,137 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostnoperm", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostnoperm", + "name": ".FormStHostAppNoPerm", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..82197c8dcfe64fd2a8c42cb30422c070abb57782 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,333 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State canCreateForm: boolean = false; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private stateForm = "visible"; + private stateIds = []; + private requestForm = false; + private requestId = "-1"; + private releaseForm = false; + private releaseId = "-1"; + private deleteForm = false; + private deleteId = "-1"; + private temporary = false; + private castForm = false; + + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; + private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; + private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; + private formOnStateEvent = "FMS_FormOnState_commonEvent"; + + private publishCallBack() { + console.debug("====>formOnErrorEvent Publish CallBack ====>"); + } + + private aboutToAppear() { + console.error('[FormComponent] getWant'); + featureAbility.getWant() + .then((want: any) => { + this.formId = parseInt(want.parameters.formId); + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if(want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + if(want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if(want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + if(want.parameters.castForm) { + this.castForm = want.parameters.castForm; + } + if(want.parameters.deleteForm) { + this.deleteForm = want.parameters.deleteForm; + } + if(want.parameters.deleteId) { + this.deleteId = want.parameters.deleteId; + } + if(want.parameters.releaseForm) { + this.releaseForm = want.parameters.releaseForm; + } + if(want.parameters.releaseId) { + this.releaseId = want.parameters.releaseId; + } + if(want.parameters.requestForm) { + this.requestForm = want.parameters.requestForm; + } + if(want.parameters.requestId) { + this.requestId = want.parameters.requestId; + } + if(want.parameters.stateForm) { + this.stateForm = want.parameters.stateForm; + } + if(want.parameters.stateIds) { + this.stateIds = want.parameters.stateIds; + } + + setTimeout(() => { + this.canCreateForm = want.parameters.isCreate ? true : false; + console.error('[FormComponent] getWant canCreateForm:'+ this.canCreateForm); + }, 10); + console.error('[FormComponent] getWant end'+ JSON.stringify(want)); + + if(!want.parameters.isCreate && this.deleteForm) { + console.log("formsystemhostnoperm deleteForm start"); + formHost.deleteForm(this.deleteId) + .then((data) => { + console.info('formsystemhostnoperm deleteForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishCallBack); + }) + .catch((error) => { + console.info('formsystemhostnoperm deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.deleteId.toString() + } + }; + commonEvent.publish(this.formOnDeletedEvent, commonEventPublishData, this.publishCallBack); + }); + + console.log("formsystemhostnoperm deleteForm end"); + } + + if(!want.parameters.isCreate && this.releaseForm) { + console.log("formsystemhost releaseForm start"); + formHost.releaseForm(this.releaseId) + .then((data) => { + console.info('formsystemhost releaseForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.requestId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, () => this.publishCallBack()); + }) + .catch((error) => { + console.info('formsystemhost releaseForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.releaseId.toString() + } + }; + commonEvent.publish(this.formOnReleasedEvent, commonEventPublishData, this.publishCallBack); + }); + + console.log("formsystemhost releaseForm end"); + } + + if(!want.parameters.isCreate && this.requestForm) { + console.log("[FormComponent.host] requestForm start"); + formHost.requestForm(this.requestId) + .then((data) => { + console.info('[FormComponent] requestForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.requestId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, () => this.publishCallBack()); + }) + .catch((error) => { + console.info('[FormComponent] requestForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.requestId + } + }; + commonEvent.publish(this.formOnRequestEvent, commonEventPublishData, this.publishCallBack); + }); + + console.log("[FormComponent.host] requestForm end"); + } + if(!want.parameters.isCreate && this.stateForm) { + if(this.stateForm == "visible") { + console.log("formsystemhost notifyVisibleForm start"); + formHost.notifyVisibleForms(this.stateIds) + .then((data) => { + console.info('formsystemhost notifyVisibleForm result:' + data); + let retData = "0"; + if((data + "") != "0") { + retData = data + ""; + } + let commonEventPublishData = { + data: retData, + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); + }) + .catch((error) => { + console.info('formsystemhost notifyVisibleForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); + }); + console.log("formsystemhost notifyVisibleForm end"); + } else if(this.stateForm == "invisible") { + console.log("formsystemhost notifyInvisibleForm start"); + formHost.notifyInvisibleForms(this.stateIds) + .then((data) => { + console.info('formsystemhost notifyInvisibleForm result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, () => this.publishCallBack()); + }) + .catch((error) => { + console.info('formsystemhost notifyInvisibleForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); + }); + console.log("formsystemhost notifyInvisibleForm end"); + } else if(this.stateForm == "enable") { + console.log("formsystemhost enableFormsUpdate start"); + formHost.enableFormsUpdate(this.stateIds) + .then((data) => { + console.info('formsystemhost enableFormsUpdate result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, () => this.publishCallBack()); + }) + .catch((error) => { + console.info('formsystemhost enableFormsUpdate error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); + }); + console.log("formsystemhost enableFormsUpdate end"); + } else { + console.log("formsystemhost disableFormsUpdate start"); + formHost.disableFormsUpdate(this.stateIds) + .then((data) => { + console.info('formsystemhost disableFormsUpdate result:' + data); + let commonEventPublishData = { + data: data + "", + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, () => this.publishCallBack()); + }) + .catch((error) => { + console.info('formsystemhost disableFormsUpdate error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + parameters: { + "formId" : this.stateIds.toString() + } + }; + commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishCallBack); + }); + console.log("formsystemhost disableFormsUpdate end"); + } + } + + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + + console.log(`[FormComponent.host] aboutToAppear end`); + } + + build() { + Column() { + Text('form component test begin') + Column() { + if (this.canCreateForm) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + this.formId = form.id; + console.log("[FormComponent.host] get form, form id:" + form.id); + }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishCallBack); + }) + } + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ed4eff045a30190f666d4a866adf2925e23d2db1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostNoPerm" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c64ff4a56c102fd7b8dfb4b5974824f1c48f19a7 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostO") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostO" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..6e442bee365d947a8f258d108b44fa6f39ad1005 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json @@ -0,0 +1,124 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhosto", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhosto", + "name": ".FormStHostAppO", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_SendCastForm_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormCast_commonEvent" + }, + { + "name": "FMS_SendCastForm_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..760a86f18f03597fb28588e0e4b3e31edb0dbc18 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,432 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import formManager from '@ohos.application.formHost'; +import commonEvent from '@ohos.commonEvent'; + +@Entry +@Component +struct Index { + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.FormAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State optType: number = 0; + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private normal = 0; + private temporary = 0; + private normaldel = 0; + private temporarydel = 0; + private normalFormIds = []; + private tempFormIds = []; + + private deleteIds = []; + private delCount = 0; + + private normalFormCounts = []; + private tempFormCounts = []; + + private castFormId = "-1"; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private subscriberSendCastForm; + private subscriberSendCastFormEvent = { + events: ["FMS_SendCastForm_commonEvent"], + }; + + private publishOnErrorCallBack() { + console.debug("====> [FormComponent] formsystemhosto formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====> [FormComponent] formsystemhosto formOnAcquiredEvent Publish CallBack ====>"); + } + private publishDeleteCallBack() { + console.debug("====> [FormComponent] formsystemhosto publishDeleteCallBack Publish CallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formCastEvent Publish CallBack ====>"); + } + private startAbility(bundleName, abilityName, sendMsg) { + featureAbility.startAbility({ + want: { + bundleName: bundleName, + abilityName: abilityName, + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "sendCastForm": true, + "sendCastFormMsg": sendMsg, + "isCreate": false + } + } + }).then((res: any) => { + console.info(`[FormComponent] formsystemhosto featureAbility.startAbility res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`[FormComponent] formsystemhosto featureAbility.startAbility error: ${JSON.stringify(err)}`); + }); + } + private publishOnSendCastForm(err, data) { + console.info("!!!====>[FormComponent] formsystemhosto OnSendCastForm start:====>" + JSON.stringify(data)); + if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhosto") { + return; + } + let formId = data.parameters.castFormId; + setTimeout(function () { + console.info("[FormComponent.host] castTempForm start, formId: " + formId); + formManager.castTempForm(formId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", data); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); + this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", error.code.toString()); + }); + console.info("[FormComponent.host] castTempForm end"); + }, 5000); + console.info("!!!====>[FormComponent] formsystemhosto OnSendCastForm end"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>[FormComponent] formsystemhosto deleteCallBack start:====>" + JSON.stringify(data)); + const delFormIds = data.parameters.formIds; + console.info(`[FormComponent] data size ${delFormIds.length}`); + + console.info(`[FormComponent] data.subscriber ${JSON.stringify(this.subscriberDel)}`); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); + }); + console.info(`[FormComponent] data.bundleName ${JSON.stringify(data.bundleName)}`); + console.info(`[FormComponent] tof ${"com.ohos.st.formsystemhosto" != data.bundleName}`); + if ("com.ohos.st.formsystemhosto" != data.bundleName) { + return; + } + delFormIds.forEach(async (formId, index) => { + console.info(`[FormComponent] formsystemhosto deleteForm ${index}`); + try { + const res = await formManager.deleteForm(formId); + console.info(`[FormComponent] formsystemhosto deleteForm ${index} ${formId} result: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`[FormComponent] formsystemhosto deleteForm ${index} ${formId} error: ${JSON.stringify(error)}`); + } + }); + console.info("!!!====> [FormComponent] formsystemhosto optType deleteCallBack end ====>"); + } + + private unSubscribeDeleteCallback() { + console.debug("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); + } + + private unSubscribeCastFormCallback() { + console.debug("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); + } + + private aboutToAppear() { + const TAG = "[FormComponent.hosto]"; + + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>[FormComponent] formsystemhosto Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + commonEvent.subscribe(this.subscriberDel, (err, data) => { + if ("com.ohos.st.formsystemhosto" != data.bundleName) { + return; + } else { + console.info("!!!====>[FormComponent.hosto] formsystemhosto deleteCallBack start:====>" + JSON.stringify(data)); + const delFormIds = data.parameters.formIds; + console.info(`[FormComponent] data size ${delFormIds.length}`); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); + }); + let delCounter = 0; + delFormIds.forEach((formId) => { + formManager.deleteForm(formId, (error, data) => { + console.info(`[FormComponent] formsystemhosto deleteForm ${++delCounter} ${formId} data: ${JSON.stringify(data)} err: ${JSON.stringify(error)}`); + }); + }); + } + }); + }); + + commonEvent.createSubscriber(this.subscriberSendCastFormEvent).then(async (data) => { + console.info("====>[FormComponent] formsystemhosto Subscriber SendCastForm data:====>", JSON.stringify(data)); + this.subscriberSendCastForm = data; + await commonEvent.subscribe(this.subscriberSendCastForm, this.publishOnSendCastForm); + }); + + featureAbility.getWant() + .then((want: any) => { + console.info(" [FormComponent] formsystemhosto getWant:" + JSON.stringify(want)); + + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + + if (want.parameters.normal) { + this.normal = want.parameters.normal; + } + + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.normaldel) { + this.normaldel = want.parameters.normaldel; + } + + if (want.parameters.temporarydel) { + this.temporarydel = want.parameters.temporarydel; + } + + if (want.parameters.deleteIds) { + this.deleteIds = want.parameters.deleteIds; + } + if (want.parameters.castFormId) { + this.castFormId = want.parameters.castFormId; + } + + this.makeCount(); + + setTimeout(() => { + this.optType = want.parameters.optType; + console.info(' [FormComponent] formsystemhosto getWant optType:' + this.optType); + }, 10); + + if (this.castFormId != "-1" && want.parameters.optType == 3) { + console.info("[FormComponent.host] castTempForm start"); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhosto optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhosto optType unSubscribeCastFormCallback CallBack====>"); + }); + + formManager.castTempForm(this.castFormId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + let commonEventPublishData = { + data: (data + "") || `0`, + bundleName: "com.ohos.st.formsystemhosto", + parameters: { + formId: this.castFormId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); + let commonEventPublishData = { + data: error.code.toString(), + bundleName: "com.ohos.st.formsystemhosto", + parameters: { + errMsg: error.message, + formId: this.castFormId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }); + console.info("[FormComponent.host] castTempForm end"); + } + + if (want.parameters.optType == 2 && this.deleteIds.length > 0) { + for (let iIndex = 0; iIndex < this.deleteIds.length; ++iIndex) { + console.info("[FormComponent] formsystemhosto deleteForm start"); + formManager.deleteForm(this.deleteIds[iIndex]) + .then((data) => { + console.info('[FormComponent] formsystemhosto deleteForm result:' + data); + this.delCount++; + + if (this.delCount == this.deleteIds.length) { + let commonEventPublishData = { + data: data + "", + bundleName: "com.ohos.st.formsystemhosto", + parameters: { + "formIds": this.deleteIds + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishDeleteCallBack); + } + }) + .catch((error) => { + console.info(' [FormComponent] formsystemhosto deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + bundleName: "com.ohos.st.formsystemhosto", + parameters: { + "formIds": [this.deleteIds[iIndex]] + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.info("[FormComponent] formsystemhosto deleteForm end"); + } + } + }) + .catch((error: any) => { + console.error(' [FormComponent] formsystemhosto Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.info(`[FormComponent.host] aboutToAppear end`); + } + + private makeCount() { + console.info(' [FormComponent] formsystemhosto makeCount start.'); + for (let nNormal = 0; nNormal < this.normal; nNormal++) { + this.normalFormCounts.push(nNormal); + } + console.info(' [FormComponent] formsystemhosto this.normalFormCounts.length:' + this.normalFormCounts.length); + + for (let nTemp = 0; nTemp < this.temporary; nTemp++) { + this.tempFormCounts.push(nTemp); + } + console.info(' [FormComponent] formsystemhosto this.tempFormCounts.length:' + this.tempFormCounts.length); + } + + build() { + Scroll(new Scroller()) { + Column() { + if (this.optType == 1) { + Text(' [FormComponent] formsystemhosto normal form component test begin') + Grid() { + ForEach(this.normalFormCounts, (item) => { + GridItem() { + FormComponent({ + id: 0, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: false + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(" [FormComponent] formsystemhosto get normal form, form id:" + form.id); + + this.normalFormIds.push(form.id.toString()); + if (this.normalFormIds.length == this.normal - this.normaldel) { + let commonEventPublishData = { + data: "normalForm", + bundleName: "com.ohos.st.formsystemhosto", + parameters: { + "formIds": this.normalFormIds + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onError((error) => { + console.info(" [FormComponent] formsystemhosto normal form error code:" + error.errcode); + console.info(" [FormComponent] formsystemhosto normal form error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg, + bundleName: "com.ohos.st.formsystemhosto" + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .size({ width: 40, height: 40 }) + } + }, (item) => JSON.stringify(item)) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') + .columnsGap(2) + .rowsGap(2) + .width('100%') + Text(' [FormComponent] formsystemhosto normal form component test end') + + Text(' [FormComponent] formsystemhosto temp form component test start') + Grid() { + ForEach(this.tempFormCounts, (item) => { + GridItem() { + FormComponent({ + id: 0, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: true + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(" [FormComponent] formsystemhosto get temp form, form id:" + form.id); + this.tempFormIds.push(form.id.toString()); + if (this.tempFormIds.length == this.temporary - this.temporarydel) { + let commonEventPublishData = { + data: "tempForm", + bundleName: "com.ohos.st.formsystemhosto", + parameters: { + "formIds": this.tempFormIds + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onError((error) => { + console.info(" [FormComponent] formsystemhosto temp form error code:" + error.errcode); + console.info(" [FormComponent] formsystemhosto temp form error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg, + bundleName: "com.ohos.st.formsystemhosto" + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .size({ width: 40, height: 40 }) + } + }, (item) => JSON.stringify(item)) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') + .columnsGap(2) + .rowsGap(2) + .width('100%') + + Text(' [FormComponent] formsystemhosto temp form component test end') + } + } + .backgroundColor(Color.White) + } + .scrollable(ScrollDirection.Vertical) + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7a3cce586e04cec4f9646390c508eb7e10001ce6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostO" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/BUILD.gn b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f107578971158d37528f339738e7dfdea5b53c21 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemHostP") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "FormSystemHostP" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/Test.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..90f1833b1bc8fd3dc1fe168f92f574f968b1f524 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json @@ -0,0 +1,124 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemhostp", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemhostp", + "name": ".FormStHostAppP", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_SendCastForm_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent" + }, + { + "name": "FMS_FormCast_commonEvent" + }, + { + "name": "FMS_SendCastForm_commonEvent" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.REQUIRE_FORM" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..e88deae73252f64f101cbb565ec7d7a983ed2e5b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent.host] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent.host] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9f267f07a4b71d176caa75bf7e79adddb92c1ef --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,422 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import formHost from '@ohos.application.formHost'; +import commonEvent from '@ohos.commonEvent'; + +@Entry +@Component +struct Index { + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.FormAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + @State optType: number = 0; + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private normal = 0; + private temporary = 0; + private normaldel = 0; + private temporarydel = 0; + private normalFormIds = []; + private tempFormIds = []; + + private deleteIds = []; + private delCount = 0; + + private normalFormCounts = []; + private tempFormCounts = []; + + private castFormId = "-1"; + + private formOnAcquiredEvent = "FMS_FormOnAcquired_commonEvent"; + private formOnErrorEvent = "FMS_FormOnError_commonEvent"; + private formCastEvent = "FMS_FormCast_commonEvent"; + + private subscriberDel; + private subscriberFormDeleteEvent = { + events: ["FMS_FormDelete_commonEvent"], + }; + + private subscriberSendCastForm; + private subscriberSendCastFormEvent = { + events: ["FMS_SendCastForm_commonEvent"], + }; + + private publishOnErrorCallBack() { + console.debug("====> [FormComponent] formsystemhostp formOnErrorEvent Publish CallBack ====>"); + } + private publishOnAcquiredCallBack() { + console.debug("====> [FormComponent] formsystemhostp formOnAcquiredEvent Publish CallBack ====>"); + } + private publishDeleteCallBack() { + console.debug("====> [FormComponent] formsystemhostp publishDeleteCallBack Publish CallBack ====>"); + } + private publishCastCallBack() { + console.debug("====>formCastEvent Publish CallBack ====>"); + } + private startAbility(bundleName, abilityName, sendMsg) { + featureAbility.startAbility({ + want: { + bundleName: bundleName, + abilityName: abilityName, + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "sendCastForm": true, + "sendCastFormMsg": sendMsg, + "isCreate": false + } + } + }).then((res: any) => { + console.info(`[FormComponent] formsystemhostp featureAbility.startAbility res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`[FormComponent] formsystemhostp featureAbility.startAbility error: ${JSON.stringify(err)}`); + }); + } + private publishOnSendCastForm(err, data) { + console.info("!!!====>[FormComponent] formsystemhostp OnSendCastForm start:====>" + JSON.stringify(data)); + if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhostp") { + return; + } + let formId = data.parameters.castFormId; + setTimeout(function () { + console.info("[FormComponent.host] castTempForm start, formId: " + formId); + formHost.castTempForm(formId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", data); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); + this.startAbility("com.ohos.st.formsystemhostc", "com.ohos.st.formsystemhostc.MainAbility", error.code.toString()); + }); + console.info("[FormComponent.host] castTempForm end"); + }, 5000); + console.info("!!!====>[FormComponent] formsystemhostp OnSendCastForm end"); + } + + private deleteCallBack(err, data) { + console.info("!!!====>[FormComponent] formsystemhostp deleteCallBack start:====>" + JSON.stringify(data)); + const delFormIds = data.parameters.formIds; + console.info(`[FormComponent] data size ${delFormIds.length}`); + + console.info(`[FormComponent] data.subscriber ${JSON.stringify(this.subscriberDel)}`); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostp optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostp optType unSubscribeCastFormCallback CallBack====>"); + }); + console.info(`[FormComponent] data.bundleName ${JSON.stringify(data.bundleName)}`); + console.info(`[FormComponent] tof ${"com.ohos.st.formsystemhostp" != data.bundleName}`); + if ("com.ohos.st.formsystemhostp" != data.bundleName) { + return; + } + delFormIds.forEach(async (formId, index) => { + console.info(`[FormComponent] formsystemhostp deleteForm ${index}`); + try { + const res = await formHost.deleteForm(formId); + console.info(`[FormComponent] formsystemhostp deleteForm ${index} ${formId} result: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`[FormComponent] formsystemhostp deleteForm ${index} ${formId} error: ${JSON.stringify(error)}`); + } + }); + console.info("!!!====> [FormComponent] formsystemhostp optType deleteCallBack end ====>"); + } + + private aboutToAppear() { + commonEvent.createSubscriber(this.subscriberFormDeleteEvent).then(async (data) => { + console.info("====>[FormComponent] formsystemhostp Subscriber FormDelete data:====>", JSON.stringify(data)); + this.subscriberDel = data; + commonEvent.subscribe(this.subscriberDel, (err, data) => { + if ("com.ohos.st.formsystemhostp" != data.bundleName) { + return; + } else { + console.info("!!!====>[FormComponent.hostp] formsystemhostp deleteCallBack start:====>" + JSON.stringify(data)); + const delFormIds = data.parameters.formIds; + console.info(`[FormComponent] data size ${delFormIds.length}`); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostp optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostp optType unSubscribeCastFormCallback CallBack====>"); + }); + let delCounter = 0; + delFormIds.forEach((formId) => { + formHost.deleteForm(formId, (error, data) => { + console.info(`[FormComponent] formsystemhostp deleteForm ${++delCounter} ${formId} data: ${JSON.stringify(data)} err: ${JSON.stringify(error)}`); + }); + }); + } + }); + }); + + commonEvent.createSubscriber(this.subscriberSendCastFormEvent).then(async (data) => { + console.info("====>[FormComponent] formsystemhostp Subscriber SendCastForm data:====>", JSON.stringify(data)); + this.subscriberSendCastForm = data; + await commonEvent.subscribe(this.subscriberSendCastForm, this.publishOnSendCastForm); + }); + + featureAbility.getWant() + .then((want: any) => { + console.info(" [FormComponent] formsystemhostp getWant:" + JSON.stringify(want)); + + this.name = want.parameters.name; + this.bundle = want.parameters.bundle; + this.ability = want.parameters.ability; + if (want.parameters.moduleName) { + this.moduleName = want.parameters.moduleName; + } + + if (want.parameters.dimension) { + this.dimension = want.parameters.dimension; + } + + if (want.parameters.normal) { + this.normal = want.parameters.normal; + } + + if (want.parameters.temporary) { + this.temporary = want.parameters.temporary; + } + if (want.parameters.normaldel) { + this.normaldel = want.parameters.normaldel; + } + + if (want.parameters.temporarydel) { + this.temporarydel = want.parameters.temporarydel; + } + + if (want.parameters.deleteIds) { + this.deleteIds = want.parameters.deleteIds; + } + if (want.parameters.castFormId) { + this.castFormId = want.parameters.castFormId; + } + + this.makeCount(); + + setTimeout(() => { + this.optType = want.parameters.optType; + console.info(' [FormComponent] formsystemhostp getWant optType:' + this.optType); + }, 10); + + if (this.castFormId != "-1" && want.parameters.optType == 3) { + console.info("[FormComponent.host] castTempForm start"); + commonEvent.unsubscribe(this.subscriberDel, () => { + console.info("====> [FormComponent] formsystemhostp optType unSubscribeDeleteCallback CallBack====>"); + }); + commonEvent.unsubscribe(this.subscriberSendCastForm, () => { + console.info("====> [FormComponent] formsystemhostp optType unSubscribeCastFormCallback CallBack====>"); + }); + + formHost.castTempForm(this.castFormId) + .then((data) => { + console.info('[FormComponent] castTempForm result:' + data); + let commonEventPublishData = { + data: (data + "") || `0`, + bundleName: "com.ohos.st.formsystemhostp", + parameters: { + formId: this.castFormId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }) + .catch((error) => { + console.info('[FormComponent] castTempForm error:' + JSON.stringify(error)); + let commonEventPublishData = { + data: error.code.toString(), + bundleName: "com.ohos.st.formsystemhostp", + parameters: { + errMsg: error.message, + formId: this.castFormId.toString() + } + }; + commonEvent.publish(this.formCastEvent, commonEventPublishData, this.publishCastCallBack); + }); + console.info("[FormComponent.host] castTempForm end"); + } + + if (want.parameters.optType == 2 && this.deleteIds.length > 0) { + for (let iIndex = 0; iIndex < this.deleteIds.length; ++iIndex) { + console.info("[FormComponent] formsystemhostp deleteForm start"); + formHost.deleteForm(this.deleteIds[iIndex]) + .then((data) => { + console.info('[FormComponent] formsystemhostp deleteForm result:' + data); + this.delCount++; + + if (this.delCount == this.deleteIds.length) { + let commonEventPublishData = { + data: data + "", + bundleName: "com.ohos.st.formsystemhostp", + parameters: { + "formIds": this.deleteIds + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishDeleteCallBack); + } + }) + .catch((error) => { + console.info(' [FormComponent] formsystemhostp deleteForm error:' + error); + let commonEventPublishData = { + data: error.code.toString(), + bundleName: "com.ohos.st.formsystemhostp", + parameters: { + "formIds": [this.deleteIds[iIndex]] + } + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }); + console.info("[FormComponent] formsystemhostp deleteForm end"); + } + } + }) + .catch((error: any) => { + console.error(' [FormComponent] formsystemhostp Operation failed. Cause: ' + JSON.stringify(error)); + }) + console.info(`[FormComponent.host] aboutToAppear end`); + } + + private makeCount() { + console.info(' [FormComponent] formsystemhostp makeCount start.'); + for (let nNormal = 0; nNormal < this.normal; nNormal++) { + this.normalFormCounts.push(nNormal); + } + console.info(' [FormComponent] formsystemhostp this.normalFormCounts.length:' + this.normalFormCounts.length); + + for (let nTemp = 0; nTemp < this.temporary; nTemp++) { + this.tempFormCounts.push(nTemp); + } + console.info(' [FormComponent] formsystemhostp this.tempFormCounts.length:' + this.tempFormCounts.length); + } + + build() { + Scroll(new Scroller()) { + Column() { + if (this.optType == 1) { + Text(' [FormComponent] formsystemhostp normal form component test begin') + Grid() { + ForEach(this.normalFormCounts, (item) => { + GridItem() { + FormComponent({ + id: 0, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: false + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(" [FormComponent] formsystemhostp get normal form, form id:" + form.id); + + this.normalFormIds.push(form.id.toString()); + if (this.normalFormIds.length == this.normal - this.normaldel) { + let commonEventPublishData = { + data: "normalForm", + bundleName: "com.ohos.st.formsystemhostp", + parameters: { + "formIds": this.normalFormIds + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onError((error) => { + console.info(" [FormComponent] formsystemhostp normal form error code:" + error.errcode); + console.info(" [FormComponent] formsystemhostp normal form error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg, + bundleName: "com.ohos.st.formsystemhostp" + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .size({ width: 40, height: 40 }) + } + }, (item) => JSON.stringify(item)) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') + .columnsGap(2) + .rowsGap(2) + .width('100%') + Text(' [FormComponent] formsystemhostp normal form component test end') + + Text(' [FormComponent] formsystemhostp temp form component test start') + Grid() { + ForEach(this.tempFormCounts, (item) => { + GridItem() { + FormComponent({ + id: 0, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: true + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.info(" [FormComponent] formsystemhostp get temp form, form id:" + form.id); + this.tempFormIds.push(form.id.toString()); + if (this.tempFormIds.length == this.temporary - this.temporarydel) { + let commonEventPublishData = { + data: "tempForm", + bundleName: "com.ohos.st.formsystemhostp", + parameters: { + "formIds": this.tempFormIds + } + }; + commonEvent.publish(this.formOnAcquiredEvent, commonEventPublishData, this.publishOnAcquiredCallBack); + } + }) + .onError((error) => { + console.info(" [FormComponent] formsystemhostp temp form error code:" + error.errcode); + console.info(" [FormComponent] formsystemhostp temp form error msg:" + error.msg); + let commonEventPublishData = { + data: error.msg, + bundleName: "com.ohos.st.formsystemhostp" + }; + commonEvent.publish(this.formOnErrorEvent, commonEventPublishData, this.publishOnErrorCallBack); + }) + .size({ width: 40, height: 40 }) + } + }, (item) => JSON.stringify(item)) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ') + .columnsGap(2) + .rowsGap(2) + .width('100%') + + Text(' [FormComponent] formsystemhostp temp form component test end') + } + } + .backgroundColor(Color.White) + } + .scrollable(ScrollDirection.Vertical) + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..82d9a31978db4e70bf720c0871e8aed7a3aaf4f3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formhostP" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5d19bdb474422ecbb2e85cedbf305f9b68826497 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestservicea.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestservicea.hmservice", + "name": ".FormSupplyAppA", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "Form_Js001", + "isDefault": true, + "scheduledUpdateTime": "10:30", + "formVisibleNotify": true, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form 001", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName":"Form_Js002", + "isDefault":false, + "defaultDimension":"2*2", + "formVisibleNotify":true, + "name":"Form_Js002", + "colorMode":"auto", + "description":"This is a form 002", + "supportDimensions":[ + "1*2", + "2*2" + ], + "type":"JS", + "updateEnabled":true, + "updateDuration":1 + } + ], + "srcLanguage": "ets" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/second" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "Form_Js001", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "reason": "need use FormSupply commonEvent", + "name": "FMS_FormSupply_commonEvent" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a5682da52dc42dd4a9b7511047dbe41bff7df7a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,88 @@ +import formBindingData from '@ohos.application.formBindingData' +import commonEvent from '@ohos.commonEvent' + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + onCreate(want) { + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + count: 10 + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind" : "onCreate", + "parameters" : JSON.stringify(want), + "data" : JSON.stringify(formData) + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + onUpdate(formId) { + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onUpdate", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onCastToNormal(formId) { + console.info('FormAbility onCastTemp, formId: ' + formId); + + var commonEventPublishData = { + parameters: { + "kind" : "onCastToNormal", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onEvent(formId, message) { + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + + var commonEventPublishData = { + parameters: { + "kind" : "onEvent", + "parameters" : formId, + "data" : message + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onVisibilityChange(formEvents) { + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind" : "onVisibilityChange", + "parameters" : JSON.stringify(formEvents), + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onDestroy(formId) { + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onDestroy", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.css b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b52e9bfa91f56e9c07e00384da135250752a03cc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.css @@ -0,0 +1,19 @@ +#wrapper { + flex-direction: column; +} + +#div1 { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + background-color: white; +} + +#text1 { + height: 45px; + width: 150px; + font-size: 16px; + text-align: center; +} + diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.hml b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b01936fb18990555228d425ea5860c785862aa50 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.hml @@ -0,0 +1,7 @@ +
+
+
+ {{title}} +
+
+
\ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.json new file mode 100644 index 0000000000000000000000000000000000000000..1c9e2ce993cf9193502ea0a014beb511aac12a73 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/js/Form_Js001/pages/index/index.json @@ -0,0 +1,6 @@ +{ + "actions": {}, + "data": { + "title": "Hello World" + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..24e9bc091781022e41951917bed002c14a2e85f1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "A提供方" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..3ee65354333d9eaad62e2a8827aafdf7e7310789 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json @@ -0,0 +1,139 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestserviceb.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestserviceb.hmservice", + "name": ".FormSupplyAppB", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "widget", + "isDefault": true, + "formVisibleNotify": true, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form 001", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName":"widget", + "isDefault":false, + "defaultDimension":"2*2", + "formVisibleNotify":true, + "name":"Form_Js002", + "colorMode":"auto", + "description":"This is a form 002", + "supportDimensions":[ + "1*2", + "2*2" + ], + "type":"JS", + "updateEnabled":true, + "scheduledUpdateTime": "10:30" + } + ], + "srcLanguage": "ets" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "widget", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a5682da52dc42dd4a9b7511047dbe41bff7df7a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,88 @@ +import formBindingData from '@ohos.application.formBindingData' +import commonEvent from '@ohos.commonEvent' + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + onCreate(want) { + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + count: 10 + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind" : "onCreate", + "parameters" : JSON.stringify(want), + "data" : JSON.stringify(formData) + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + onUpdate(formId) { + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onUpdate", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onCastToNormal(formId) { + console.info('FormAbility onCastTemp, formId: ' + formId); + + var commonEventPublishData = { + parameters: { + "kind" : "onCastToNormal", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onEvent(formId, message) { + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + + var commonEventPublishData = { + parameters: { + "kind" : "onEvent", + "parameters" : formId, + "data" : message + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onVisibilityChange(formEvents) { + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind" : "onVisibilityChange", + "parameters" : JSON.stringify(formEvents), + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onDestroy(formId) { + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onDestroy", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_list.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_list.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_list.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_tv.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_vision.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_vision.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/ic_vision.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/js/widget/pages/index/index.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f9b4dc77e6557a258f9fccfcc35d6d96980d6548 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "B提供方" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/FormAbility/form.ts similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/FormAbility/form.ts rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/FormAbility/form.ts diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..68423fd2ef25779a2211b837ec11507ea485ec31 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_list.svg @@ -0,0 +1,22 @@ + + + + ic_list + Created with Sketch. + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_tv.svg diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_vision.svg new file mode 100644 index 0000000000000000000000000000000000000000..572f8e6c39fb6095ce491d2e87d6c739f3bd08e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/ic_vision.svg @@ -0,0 +1,29 @@ + + + ic_vision + + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/js/widget/pages/index/index.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..514dc4b0f78107e6cc8f791ec3fa6a42b1e2410e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json @@ -0,0 +1,139 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestserviced.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestserviced.hmservice", + "name": ".FormSupplyAppD", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "widget", + "isDefault": true, + "formVisibleNotify": false, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form 001", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName":"widget", + "isDefault":false, + "defaultDimension":"2*2", + "formVisibleNotify":true, + "name":"Form_Js002", + "colorMode":"auto", + "description":"This is a form 002", + "supportDimensions":[ + "1*2", + "2*2" + ], + "type":"JS", + "updateEnabled":true, + "scheduledUpdateTime": "10:30" + } + ], + "srcLanguage": "ets" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "widget", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef5e97f0640d54266362f555701fa79e50174a5c --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,89 @@ +import formBindingData from '@ohos.application.formBindingData' +import formProvider from '@ohos.application.formProvider' +import commonEvent from '@ohos.commonEvent' + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + onCreate(want) { + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + count: 10 + }; + let bindingData = formBindingData.createFormBindingData(formData); + let commonEventPublishData = { + parameters: { + "kind" : "onCreate", + "parameters" : JSON.stringify(want), + "data" : JSON.stringify(formData) + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + onUpdate(formId) { + console.info('FormAbility onUpdate, formId: ' + formId); + let commonEventPublishData = { + parameters: { + "kind" : "onUpdate", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onCastToNormal(formId) { + console.info('FormAbility onCastTemp, formId: ' + formId); + + let commonEventPublishData = { + parameters: { + "kind" : "onCastToNormal", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onEvent(formId, message) { + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + + let commonEventPublishData = { + parameters: { + "kind" : "onEvent", + "parameters" : formId, + "data" : message + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onVisibilityChange(formEvents) { + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind" : "onVisibilityChange", + "parameters" : JSON.stringify(formEvents), + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onDestroy(formId) { + console.info('FormAbility onDestroy, formId: ' + formId); + let commonEventPublishData = { + parameters: { + "kind" : "onDestroy", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..68423fd2ef25779a2211b837ec11507ea485ec31 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_list.svg @@ -0,0 +1,22 @@ + + + + ic_list + Created with Sketch. + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_tv.svg diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_vision.svg new file mode 100644 index 0000000000000000000000000000000000000000..572f8e6c39fb6095ce491d2e87d6c739f3bd08e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/ic_vision.svg @@ -0,0 +1,29 @@ + + + ic_vision + + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/js/widget/pages/index/index.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0d046efdc9141ba241b537a0d208c7137c7769fe --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "D提供方" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..650456f8ef9c200ad401f881eec72d77d476c0f0 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestservicee.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestservicee.hmservice", + "name": ".FormSupplyAppE", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "widget", + "isDefault": true, + "scheduledUpdateTime": "10:30", + "formVisibleNotify": true, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form 001", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName":"widget", + "isDefault":false, + "defaultDimension":"2*2", + "formVisibleNotify":true, + "name":"Form_Js002", + "colorMode":"auto", + "description":"This is a form 002", + "supportDimensions":[ + "1*2", + "2*2" + ], + "type":"JS", + "updateEnabled":true, + "updateDuration":1 + } + ], + "srcLanguage": "ets" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/second" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "widget", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fe951d20af48eed82c466532335f29f93e8db7a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,99 @@ +import formBindingData from '@ohos.application.formBindingData' +import commonEvent from '@ohos.commonEvent' + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + onCreate(want) { + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + "temperature":"11c", + "time":"11:00", + "test":11, + "test3":true, + "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of' + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind" : "onCreate", + "parameters" : JSON.stringify(want), + "data" : JSON.stringify(formData) + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + onUpdate(formId) { + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onUpdate", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onCastToNormal(formId) { + console.info('FormAbility onCastTemp, formId: ' + formId); + + var commonEventPublishData = { + parameters: { + "kind" : "onCastToNormal", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onEvent(formId, message) { + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + + var commonEventPublishData = { + parameters: { + "kind" : "onEvent", + "parameters" : formId, + "data" : message + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onVisibilityChange(formEvents) { + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind" : "onVisibilityChange", + "parameters" : JSON.stringify(formEvents), + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onDestroy(formId) { + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onDestroy", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..68423fd2ef25779a2211b837ec11507ea485ec31 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_list.svg @@ -0,0 +1,22 @@ + + + + ic_list + Created with Sketch. + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_tv.svg diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_vision.svg new file mode 100644 index 0000000000000000000000000000000000000000..572f8e6c39fb6095ce491d2e87d6c739f3bd08e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/ic_vision.svg @@ -0,0 +1,29 @@ + + + ic_vision + + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/js/widget/pages/index/index.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..24e9bc091781022e41951917bed002c14a2e85f1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "A提供方" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..037dfce2884e28971dd090a793c4dcea8c81983e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,143 @@ +import commonEvent from '@ohos.commonEvent'; +import formBindingData from '@ohos.application.formBindingData'; +import formProvider from '@ohos.application.formProvider'; +import systemTime from '@ohos.systemTime'; + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + async onCreate(want) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + count: 10 + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind": "onCreate", + "parameters": JSON.stringify(want), + "data": JSON.stringify(formData), + "time": time + } + }; + console.info(`FormAbility data ${JSON.stringify(commonEventPublishData)}`); + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + async onUpdate(formId) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind": "onUpdate", + "parameters": formId, + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + async onCastToNormal(formId) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onCastTemp, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind": "onCastToNormal", + "parameters": formId, + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + async onEvent(formId, message) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + var commonEventPublishData = { + parameters: { + "kind": "onEvent", + "parameters": formId, + "data": message, + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + async onVisibilityChange(formEvents) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind": "onVisibilityChange", + "parameters": JSON.stringify(formEvents), + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + + for (let key in formEvents) { + const value = formEvents[key]; + key = key.toString(); + console.log('form_extension onVisibilityChange, key:' + key + ", value=" + value); + let dataObj = { + temperature: "22°", + time: "22:00", + test: 22, + }; + let obj = formBindingData.createFormBindingData(dataObj); + + const updateFormStartTime = await systemTime.getCurrentTime(); + let data = await formProvider.updateForm(key, obj); + console.info('FormAbility onUpdateForm, res: ' + data); + const updateFormEndTime = await systemTime.getCurrentTime(); + + commonEventPublishData = { + parameters: { + "kind": "onUpdateForm", + "parameters": key, + "data": "", + "time": updateFormEndTime - updateFormStartTime + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + + const setFormNextRefreshTimeStartTime = await systemTime.getCurrentTime(); + data = await formProvider.setFormNextRefreshTime(key, 5); + console.info('FormAbility setFormNextRefreshTime, res: ' + data); + const setFormNextRefreshTimeEndTime = await systemTime.getCurrentTime(); + + commonEventPublishData = { + parameters: { + "kind": "onSetFormNextRefreshTime", + "parameters": key, + "data": "", + "time": setFormNextRefreshTimeEndTime - setFormNextRefreshTimeStartTime + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } + }, + async onDestroy(formId) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind": "onDestroy", + "parameters": formId, + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..68423fd2ef25779a2211b837ec11507ea485ec31 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_list.svg @@ -0,0 +1,22 @@ + + + + ic_list + Created with Sketch. + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_tv.svg diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_vision.svg new file mode 100644 index 0000000000000000000000000000000000000000..572f8e6c39fb6095ce491d2e87d6c739f3bd08e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/ic_vision.svg @@ -0,0 +1,29 @@ + + + ic_vision + + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/js/Form_Js001/pages/index/index.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3300831acc5c72a6edd6ce3d5144396a889f3f55 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "提供方F" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..389435140fe597cbad596896cb387e94536dced8 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json @@ -0,0 +1,124 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestserviceg.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestserviceg.hmservice", + "name": ".FormSupplyAppG", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "Form_Js001", + "isDefault": true, + "scheduledUpdateTime": "10:30", + "formVisibleNotify": true, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form widget", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + } + ], + "srcLanguage": "ets" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/second" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "Form_Js001", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "reason": "need use FormSupply commonEvent", + "name": "FMS_FormSupply_commonEvent" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..5b855c11f204824f84f86c3eef9a54011f2973da --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,155 @@ +import commonEvent from '@ohos.commonEvent'; +import formBindingData from '@ohos.application.formBindingData'; +import formProvider from '@ohos.application.formProvider'; +import systemTime from '@ohos.systemTime'; + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + async onCreate(want) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang", + epidemic: true, + "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of', + count: 10 + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind": "onCreate", + "parameters": JSON.stringify(want), + "data": JSON.stringify(formData), + "time": time + } + }; + console.info(`FormAbility data ${JSON.stringify(commonEventPublishData)}`); + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + async onUpdate(formId) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind": "onUpdate", + "parameters": formId, + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + async onCastToNormal(formId) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onCastTemp, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind": "onCastToNormal", + "parameters": formId, + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + async onEvent(formId, message) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + var commonEventPublishData = { + parameters: { + "kind": "onEvent", + "parameters": formId, + "data": message, + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + async onVisibilityChange(formEvents) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind": "onVisibilityChange", + "parameters": JSON.stringify(formEvents), + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + + for (let key in formEvents) { + const value = formEvents[key]; + key = key.toString(); + console.log('form_extension onVisibilityChange, key:' + key + ", value=" + value); + let dataObj = { + temperature: "22°", + time: "22:00", + test: 22, + }; + let obj = formBindingData.createFormBindingData(dataObj); + + const updateFormStartTime = await systemTime.getCurrentTime(); + let data = await formProvider.updateForm(key, obj); + console.info('FormAbility onUpdateForm, res: ' + data); + const updateFormEndTime = await systemTime.getCurrentTime(); + + commonEventPublishData = { + parameters: { + "kind": "onUpdateForm", + "parameters": key, + "data": "", + "time": updateFormEndTime - updateFormStartTime + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + + const setFormNextRefreshTimeStartTime = await systemTime.getCurrentTime(); + data = await formProvider.setFormNextRefreshTime(key, 5); + console.info('FormAbility setFormNextRefreshTime, res: ' + data); + const setFormNextRefreshTimeEndTime = await systemTime.getCurrentTime(); + + commonEventPublishData = { + parameters: { + "kind": "onSetFormNextRefreshTime", + "parameters": key, + "data": "", + "time": setFormNextRefreshTimeEndTime - setFormNextRefreshTimeStartTime + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } + }, + async onDestroy(formId) { + const time = await systemTime.getCurrentTime(); + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind": "onDestroy", + "parameters": formId, + "data": "", + "time": time + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_device_earphone_hero_filled1.png diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..68423fd2ef25779a2211b837ec11507ea485ec31 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_list.svg @@ -0,0 +1,22 @@ + + + + ic_list + Created with Sketch. + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_tv.svg diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_vision.svg new file mode 100644 index 0000000000000000000000000000000000000000..572f8e6c39fb6095ce491d2e87d6c739f3bd08e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/ic_vision.svg @@ -0,0 +1,29 @@ + + + ic_vision + + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/js/Form_Js001/pages/index/index.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1c9e50b08835f88eece235a6ee0193d753f52e7d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "提供方G" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..734f57ff8a2ca909697e995d9b4b94e50351a038 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestserviceh.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestserviceh.hmservice", + "name": ".FormSupplyAppH", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "widget", + "isDefault": true, + "scheduledUpdateTime": "10:30", + "formVisibleNotify": true, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form 001", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName":"widget", + "isDefault":false, + "defaultDimension":"2*2", + "formVisibleNotify":true, + "name":"Form_Js002", + "colorMode":"auto", + "description":"This is a form 002", + "supportDimensions":[ + "1*2", + "2*2" + ], + "type":"JS", + "updateEnabled":true, + "updateDuration":1 + } + ], + "srcLanguage": "ets" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/second" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "widget", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fe951d20af48eed82c466532335f29f93e8db7a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,99 @@ +import formBindingData from '@ohos.application.formBindingData' +import commonEvent from '@ohos.commonEvent' + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + onCreate(want) { + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + "temperature":"11c", + "time":"11:00", + "test":11, + "test3":true, + "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of' + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind" : "onCreate", + "parameters" : JSON.stringify(want), + "data" : JSON.stringify(formData) + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + onUpdate(formId) { + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onUpdate", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onCastToNormal(formId) { + console.info('FormAbility onCastTemp, formId: ' + formId); + + var commonEventPublishData = { + parameters: { + "kind" : "onCastToNormal", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onEvent(formId, message) { + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + + var commonEventPublishData = { + parameters: { + "kind" : "onEvent", + "parameters" : formId, + "data" : message + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onVisibilityChange(formEvents) { + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind" : "onVisibilityChange", + "parameters" : JSON.stringify(formEvents), + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onDestroy(formId) { + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onDestroy", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_2.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_2.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_2.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/image_2.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/close.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/close.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/close.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/close.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_HD1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_HD1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_HD1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_HD1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_box1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image@3x.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image@3x.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image@3x.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_image@3x.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_white.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_white.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_white.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_default_white.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_device_earphone_hero_filled1.png diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_list.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..68423fd2ef25779a2211b837ec11507ea485ec31 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_list.svg @@ -0,0 +1,22 @@ + + + + ic_list + Created with Sketch. + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pad1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc1.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc1.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc1.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_pc1.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_public_search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_public_search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_public_search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_public_search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_selfie.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_selfie.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_selfie.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_selfie.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_tv.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_tv.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_tv.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_tv.svg diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_vision.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_vision.svg new file mode 100644 index 0000000000000000000000000000000000000000..572f8e6c39fb6095ce491d2e87d6c739f3bd08e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/ic_vision.svg @@ -0,0 +1,29 @@ + + + ic_vision + + + + + \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/search.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/search.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/search.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/search.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/superdevice.svg b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/superdevice.svg similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/superdevice.svg rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/superdevice.svg diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/template.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/template.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/template.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/common/img/template.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/manifest.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/manifest.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/manifest.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/manifest.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/pages/index/index.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/pages/index/index.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/js/widget/pages/index/index.json diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..55bfa0276794c25a6b78ea407b640db3a3650b81 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "H提供方" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..20d6ca20267b58c21a4fdf073cf3edd911c06aee --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.form.formsystemtestservicenotsysapp.hmservice", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.form.formsystemtestservicenotsysapp.hmservice", + "name": ".FormSupplyAppNS", + "mainAbility": ".MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "name": ".FormAbility", + "srcPath": "FormAbility", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "formsEnabled": true, + "forms": [ + { + "jsComponentName": "Form_Js001", + "isDefault": true, + "scheduledUpdateTime": "10:30", + "formVisibleNotify": true, + "defaultDimension": "1*2", + "name": "Form_Js001", + "description": "This is a form 001", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName":"Form_Js002", + "isDefault":false, + "defaultDimension":"2*2", + "formVisibleNotify":true, + "name":"Form_Js002", + "colorMode":"auto", + "description":"This is a form 002", + "supportDimensions":[ + "1*2", + "2*2" + ], + "type":"JS", + "updateEnabled":true, + "updateDuration":1 + } + ], + "srcLanguage": "ets" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/second" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "Form_Js001", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "reason": "need use FormSupply commonEvent", + "name": "FMS_FormSupply_commonEvent" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/FormAbility/form.ts b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/FormAbility/form.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fe951d20af48eed82c466532335f29f93e8db7a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/FormAbility/form.ts @@ -0,0 +1,99 @@ +import formBindingData from '@ohos.application.formBindingData' +import commonEvent from '@ohos.commonEvent' + +let supplyForm_Event = "FMS_FormSupply_commonEvent"; + +function publishCallBack() { + console.info("!!!====>FormAbility publishCallBack====>"); +} + +export default { + onCreate(want) { + console.info('FormAbility onCreate, want:' + JSON.stringify(want)); + let formData = { + "temperature":"11c", + "time":"11:00", + "test":11, + "test3":true, + "test_over_1k":'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of data,test over 1k of data,test over 1k of data' + + 'test over 1k of data,test over 1k of' + }; + let bindingData = formBindingData.createFormBindingData(formData); + var commonEventPublishData = { + parameters: { + "kind" : "onCreate", + "parameters" : JSON.stringify(want), + "data" : JSON.stringify(formData) + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + return bindingData; + }, + onUpdate(formId) { + console.info('FormAbility onUpdate, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onUpdate", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onCastToNormal(formId) { + console.info('FormAbility onCastTemp, formId: ' + formId); + + var commonEventPublishData = { + parameters: { + "kind" : "onCastToNormal", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onEvent(formId, message) { + console.info('FormAbility onTriggerEvent, formId: ' + formId + 'message: ' + message); + + var commonEventPublishData = { + parameters: { + "kind" : "onEvent", + "parameters" : formId, + "data" : message + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onVisibilityChange(formEvents) { + console.info('FormAbility onVisibilityChanged, ' + JSON.stringify(formEvents)); + var commonEventPublishData = { + parameters: { + "kind" : "onVisibilityChange", + "parameters" : JSON.stringify(formEvents), + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + }, + onDestroy(formId) { + console.info('FormAbility onDestroy, formId: ' + formId); + var commonEventPublishData = { + parameters: { + "kind" : "onDestroy", + "parameters" : formId, + "data" : "" + } + }; + commonEvent.publish(supplyForm_Event, commonEventPublishData, publishCallBack); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/app.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/index.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/second.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/second.ets rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/ets/MainAbility/pages/second.ets diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.css b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b52e9bfa91f56e9c07e00384da135250752a03cc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.css @@ -0,0 +1,19 @@ +#wrapper { + flex-direction: column; +} + +#div1 { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + background-color: white; +} + +#text1 { + height: 45px; + width: 150px; + font-size: 16px; + text-align: center; +} + diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.hml b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b01936fb18990555228d425ea5860c785862aa50 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.hml @@ -0,0 +1,7 @@ +
+
+
+ {{title}} +
+
+
\ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.json new file mode 100644 index 0000000000000000000000000000000000000000..1c9e2ce993cf9193502ea0a014beb511aac12a73 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/js/Form_Js001/pages/index/index.json @@ -0,0 +1,6 @@ +{ + "actions": {}, + "data": { + "title": "Hello World" + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8d1f2ba0bcb198081563d61fc25afbdb5ef9f0b1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "NS提供方" + }, + { + "name": "description_mainability", + "value": "eTS_Empty Ability" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..272ca9e0c358f338c4c2f3acfd31f27dcc13cdf8 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemProviderA") { + hap_name = "FormSystemProviderA" + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d9fdcb92f81eac53bf51c78a428be0210c192b89 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ad2fd2f88454ab6b77ae4bc964466dc514a470f3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json @@ -0,0 +1,173 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemprovidera", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemprovidera", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "form_module_a", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "launchType": "standard", + "formsEnabled": true, + "forms": [ + { + "name": "FormA_Js001", + "description": "form_description_FormA_Js001", + "descriptionId": 0, + "isDefault": true, + "type": "JS", + "colorMode": "dark", + "supportDimensions": [ + "1*2", + "2*4" + ], + "defaultDimension": "1*2", + "updateEnabled": true, + "updateDuration": 1, + "scheduledUpdateTime": "5:30", + "jsComponentName": "card_a01", + "formVisibleNotify": true, + "formConfigAbility": "abilitya01", + "metaData": { + "customizeData": [ + { + "name": "originWidgetNameA01", + "value": "valueA01" + } + ] + } + }, + { + "name": "FormA_Js002", + "description": "form_description_FormA_Js002", + "descriptionId": 10, + "isDefault": false, + "type": "JS", + "colorMode": "light", + "supportDimensions": [ + "1*2", + "2*2", + "2*4", + "4*4" + ], + "defaultDimension": "4*4", + "updateEnabled": false, + "updateDuration": 2, + "scheduledUpdateTime": "20:30", + "jsComponentName": "card_a02", + "formVisibleNotify": false, + "formConfigAbility": "abilitya02", + "metaData": { + "customizeData": [ + { + "name": "originWidgetNameA02", + "value": "valueA02" + } + ] + } + } + ] + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d63635634e3aec5150137783413dc0c334c1d0e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/app.ets @@ -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(`[FormProviderA] Application onCreate`); + }, + onDestroy() { + console.info(`[FormProviderA] Application onDestroy`); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c1d75bd4f660fa174b341befcfa8a78942f937 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; + +@Entry +@Component +struct Index { + private componentName: string = `FormProviderA`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`Fms Main Ability Test`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..557331b2519ea8e5ae561a14c6c29c111e1cf5d4 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemProviderB") { + hap_name = "FormSystemProviderB" + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d9fdcb92f81eac53bf51c78a428be0210c192b89 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..162e5064dda116f79541231c61c2d1686f51aa32 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json @@ -0,0 +1,144 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemproviderb", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemproviderb", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "form_module_b", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "launchType": "standard", + "formsEnabled": true, + "forms": [ + { + "name": "FormB_Js001", + "description": "form_description_FormB_Js001", + "descriptionId": 20, + "isDefault": true, + "type": "JS", + "colorMode": "auto", + "supportDimensions": [ + "1*2", + "2*2" + ], + "defaultDimension": "2*2", + "updateEnabled": true, + "updateDuration": 3, + "scheduledUpdateTime": "10:30", + "jsComponentName": "card_b", + "formVisibleNotify": true, + "formConfigAbility": "abilityb", + "metaData": { + "customizeData": [ + { + "name": "originWidgetNameB", + "value": "valueB" + } + ] + } + } + ] + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..fff23b88f1286e6d38398613442a28e3a73c93a0 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/app.ets @@ -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(`[FormProviderB] Application onCreate`); + }, + onDestroy() { + console.info(`[FormProviderB] Application onDestroy`); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6a445c4784e3179851431321b1c07dcd1850239 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; + +@Entry +@Component +struct Index { + private componentName: string = `FormProviderB`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`Fms Main Ability Test`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3cf17f2b94562097911f4046751986334f612be2 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemProviderC") { + hap_name = "FormSystemProviderC" + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d9fdcb92f81eac53bf51c78a428be0210c192b89 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9e0dc9dd6e4809b3b7e0ae2f8beafde7cc57f7d6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json @@ -0,0 +1,144 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemproviderc", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemproviderc", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "form_module_c", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "launchType": "standard", + "formsEnabled": true, + "forms": [ + { + "name": "FormC_Js001", + "description": "form_description_FormC_Js001", + "descriptionId": 30, + "isDefault": true, + "type": "JS", + "colorMode": "light", + "supportDimensions": [ + "2*4", + "4*4" + ], + "defaultDimension": "2*4", + "updateEnabled": true, + "updateDuration": 4, + "scheduledUpdateTime": "15:30", + "jsComponentName": "card_c", + "formVisibleNotify": true, + "formConfigAbility": "abilityc", + "metaData": { + "customizeData": [ + { + "name": "originWidgetNameC", + "value": "valueC" + } + ] + } + } + ] + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9abd38b696fff4d2464e646d8b80694f3c21b59 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/app.ets @@ -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(`[FormProviderC] Application onCreate`); + }, + onDestroy() { + console.info(`[FormProviderC] Application onDestroy`); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..349acd10f9a4afc3bf65294d7edbb37cff6168ba --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; + +@Entry +@Component +struct Index { + private componentName: string = `FormProviderC`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`Fms Main Ability Test`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/BUILD.gn b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ce843fb51cf39ec87a34f21a08eed06284e7619f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("FormSystemProviderD") { + hap_name = "FormSystemProviderD" + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/Test.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d9fdcb92f81eac53bf51c78a428be0210c192b89 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d4e41013420a2ab58a815f697b1a815b1e6eda46 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json @@ -0,0 +1,116 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsystemproviderd", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsystemproviderd", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "form_module_d", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "service", + "launchType": "standard", + "formsEnabled": true, + "forms": [] + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..44dbad6078a02ed4315f7ba51689c8d34c773e69 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/app.ets @@ -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(`[FormProviderD] Application onCreate`); + }, + onDestroy() { + console.info(`[FormProviderD] Application onDestroy`); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..04e2040752022e17e645ee1629d92ed5eea662be --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; + +@Entry +@Component +struct Index { + private componentName: string = `FormProviderD`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`Fms Main Ability Test`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..934fb9670196491ec19b77befd61f7aff2ebfa01 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormAcquireTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormAcquireTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..e20b59e8618753f2c1b204e45b096ec378a56786 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formacquiretest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormAcquireTest.hap", + "FormSystemHost.hap", + "FormSystemHostB.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap", + "FormSupplyAppE.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..934996e9344963249339774c054dbcafc043ddab --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 40000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5812a21d7225da9895c4a509f3eabc613152ebd7 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets @@ -0,0 +1,1594 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onErrorForm_Event = { + events: ["FMS_FormOnError_commonEvent"], +}; +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; +var subscriberFormCastEvent = { + events: ["FMS_FormCast_commonEvent"], +}; +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnError; +var subscriberOnAcquired; +var subscriberCast; +var subscriberSupply; + +export default function test() { + describe(`FmsAcquiredFormTest`, () => { + + beforeEach(async () => { + subscriberOnError = await commonEvent.createSubscriber(onErrorForm_Event); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberCast = await commonEvent.createSubscriber(subscriberFormCastEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }) + + /** + * @tc.number: FMS_acquireForm_0200 + * @tc.name: The form host does not have permission to use the form + * @tc.desc: Failed to create a form when verifying that the form host does not have form permission. + */ + it(`FMS_acquireForm_0200`, 0, async (done) => { + console.info(`FMS_acquireForm_0200 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_0200 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("check permission deny, need to request ohos.permission.REQUIRE_FORM."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0200")); + console.info(`FMS_acquireForm_0200 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_0200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_0200 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_0300 + * @tc.name: Failed to add form when parameter formId is wrong. + * @tc.desc: Failed to create form when verifying that the parameter (formId) of creating form is wrong. + */ + it(`FMS_acquireForm_0300`, 0, async (done) => { + console.info(`FMS_acquireForm_0300 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_0300 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0300")); + console.info(`FMS_acquireForm_0300 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "-1", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_0400 + * @tc.name: Failed to add form when parameter bundlename is wrong. + * @tc.desc: Form creation failed when verifying the wrong parameter (bundlename) of form creation. + */ + it(`FMS_acquireForm_0400`, 0, async (done) => { + console.info(`FMS_acquireForm_0400 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_0400 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0400")); + console.info(`FMS_acquireForm_0400 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "-1", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice123", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_0500 + * @tc.name: Failed to add form when parameter moduleName is wrong. + * @tc.desc: Form creation failed when verifying the wrong parameter (moduleName) of form creation. + */ + it(`FMS_acquireForm_0500`, 0, async (done) => { + console.info(`FMS_acquireForm_0500 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_0500 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0500")); + console.info(`FMS_acquireForm_0500 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "-1", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry123", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_0600 + * @tc.name: Failed to add form when parameter formName is wrong. + * @tc.desc: Form creation failed when verifying the wrong parameter (formName) of form creation. + */ + it(`FMS_acquireForm_0600`, 0, async (done) => { + console.info(`FMS_acquireForm_0600 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_0600 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0600")); + console.info(`FMS_acquireForm_0600 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "-1", + "name": "Form_Js001987", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_0600 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_0700 + * @tc.name: Failed to add form when parameter abilityName is wrong. + * @tc.desc: Form creation failed when verifying the wrong parameter (abilityName) of form creation. + */ + it(`FMS_acquireForm_0700`, 0, async (done) => { + console.info(`FMS_acquireForm_0700 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_0700 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_0700")); + console.info(`FMS_acquireForm_0700 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_0700 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "-1", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility123", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_0700 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_1000 + * @tc.name: Failed to add form when parameter form dimension is wrong. + * @tc.desc: Form creation failed when verifying the wrong parameter (form dimension) of form creation. + */ + it(`FMS_acquireForm_1000`, 0, async (done) => { + console.info(`FMS_acquireForm_1000 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1000 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_1000")); + console.info(`FMS_acquireForm_1000 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_1000 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "-1", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "dimension": 4, + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1000 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_1100 + * @tc.name: When the formId is set to 0, a non cached form is added. + * @tc.desc: Verify that the non cache form can be successfully created. + */ + it(`FMS_acquireForm_1100`, 0, async (done) => { + console.info(`FMS_acquireForm_1100 start`); + let formId1; + let formId2; + + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1100 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1100")); + formId1 = data.data; + + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1100 publish' + JSON.stringify(err)); + }); + } + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onCreate") { + console.info("====>FMS_acquireForm_1100 onSupplyCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1100")); + let retData = JSON.parse(data.parameters.parameters); + + let bundleName = retData.bundleName; + expect(bundleName).assertEqual("com.form.formsystemtestservicea.hmservice"); + let abilityName = retData.abilityName; + expect(abilityName).assertEqual("com.form.formsystemtestservicea.hmservice.FormAbility"); + let moduleName = retData.parameters['ohos.extra.param.key.module_name']; + expect(moduleName).assertEqual("entry"); + let formName = retData.parameters['ohos.extra.param.key.form_name']; + expect(formName).assertEqual("Form_Js001"); + let formDimension = retData.parameters['ohos.extra.param.key.form_dimension']; + expect(formDimension).assertEqual(1); + let tempFormFlag = retData.parameters['ohos.extra.param.key.form_temporary']; + expect(tempFormFlag).assertEqual(false); + + formId2 = retData.parameters['ohos.extra.param.key.form_identity']; + + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1100 publish' + JSON.stringify(err)); + }); + } + } + } + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.info(`FMS_acquireForm_1100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1100 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_1200 + * @tc.name: When the formId is set to 0, a non cached form is added. + * @tc.desc: Verify that the non cache form can be successfully created. + */ + it(`FMS_acquireForm_1200`, 0, async (done) => { + console.info(`FMS_acquireForm_1200 start`); + let formId1; + let formId2; + + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1200 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1200")) + formId1 = data.data; + console.info("!!!====>FMS_acquireForm_1200 onAcquiredCallBack formId1:====>" + formId1); + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1200 publish' + JSON.stringify(err)); + }); + } + } + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onCreate") { + console.info("====>FMS_acquireForm_1200 onSupplyCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1200")); + let retData = JSON.parse(data.parameters.parameters); + + let bundleName = retData.bundleName; + expect(bundleName).assertEqual("com.form.formsystemtestservicee.hmservice"); + let abilityName = retData.abilityName; + expect(abilityName).assertEqual("com.form.formsystemtestservicee.hmservice.FormAbility"); + let moduleName = retData.parameters['ohos.extra.param.key.module_name']; + expect(moduleName).assertEqual("entry"); + let formName = retData.parameters['ohos.extra.param.key.form_name']; + expect(formName).assertEqual("Form_Js001"); + let formDimension = retData.parameters['ohos.extra.param.key.form_dimension']; + expect(formDimension).assertEqual(1); + let tempFormFlag = retData.parameters['ohos.extra.param.key.form_temporary']; + expect(tempFormFlag).assertEqual(false); + + formId2 = retData.parameters['ohos.extra.param.key.form_identity']; + console.info("!!!====>FMS_acquireForm_1200 onSupplyCallBack formId2:====>" + formId2); + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1200 publish' + JSON.stringify(err)); + }); + } + } + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.info(`FMS_acquireForm_1200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostb", + abilityName: "com.ohos.st.formsystemhostb.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicee.hmservice", + "ability": "com.form.formsystemtestservicee.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1200 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_1400 + * @tc.name: FormId does not match other parameters when adding a cached form. + * @tc.desc: Failed to create a cached form when verifying that FormId does not match other parameters. + */ + it(`FMS_acquireForm_1400`, 0, async (done) => { + console.info(`FMS_acquireForm_1400 start`); + var formId; + + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1400 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("the requested form id is not existed on fms."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallBackCache("FMS_acquireForm_1400")); + var commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1400 publish' + JSON.stringify(err)); + }); + } + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1400 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1400")) + formId = data.data; + // add cache form + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_1400 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "1", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1400 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.info(`FMS_acquireForm_1400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_1500 + * @tc.name: Add a cached form. + * @tc.desc: Verify that the cached form can be successfully created. + */ + it(`FMS_acquireForm_1500`, 0, async (done) => { + console.info(`FMS_acquireForm_1500 start`); + let formId1; + let formId2; + let onCreateCount = 0; + + function onAcquiredCallBackCache(_, data) { + console.info("!!!====>FMS_acquireForm_1500 onAcquiredCallBackCache data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallBackCache("FMS_acquireForm_1500")); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + formId2 = data.data; + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1500 publish' + JSON.stringify(err)); + }); + } + } + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1500 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1500")) + formId1 = data.data; + // add cache form + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBackCache); + console.info(`FMS_acquireForm_1500 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostb", + abilityName: "com.ohos.st.formsystemhostb.MainAbility", + parameters: { + "formId": formId1, + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1500 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onCreate") { + console.info("====>FMS_acquireForm_1500 onSupplyCallBack====>" + JSON.stringify(data)); + onCreateCount++; + if (onCreateCount == 2) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1500")) + } + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1500 publish' + JSON.stringify(err)); + }); + } + } + } + + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.info(`FMS_acquireForm_1500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_1500 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_1600 + * @tc.name: A single form host (using a single thread) continuously creates 2 normal and 2 temporary forms. + * @tc.desc: Verify that a single host (using a single thread) can successfully create multiple normal + * and temporary forms continuously. + */ + it(`FMS_acquireForm_1600`, 0, async (done) => { + console.info(`FMS_acquireForm_1600 start`); + + function delPublishCallBack_Normal1() { + console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Normal1====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1600 delPublishCallBack_Normal1 end'); + FMS_acquireForm_1600_normal2(); + }, 50); + } + function onAcquiredCallBack_Normal1(_, data) { + console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhost", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal1); + } + function unSubscribeOnAcquiredCallBack_Normal1() { + console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"); + } + + async function FMS_acquireForm_1600_normal1() { + console.info(`FMS_acquireForm_1600_normal1 start`); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); + console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1600_normal1 end`); + } + + function delPublishCallBack_Normal2() { + console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Normal2====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1600 delPublishCallBack_Normal2 end'); + FMS_acquireForm_1600_Temp1(); + }, 50); + } + function onAcquiredCallBack_Normal2(_, data) { + console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhost", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal2); + } + function unSubscribeOnAcquiredCallBack_Normal2() { + console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Normal2====>"); + } + async function FMS_acquireForm_1600_normal2() { + console.info(`FMS_acquireForm_1600_normal2 start`); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); + console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1600_normal2 end`); + } + + function delPublishCallBack_Temp1() { + console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Temp1====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1600 delPublishCallBack_Temp1 end'); + FMS_acquireForm_1600_Temp2(); + }, 50); + } + function onAcquiredCallBack_Temp1(_, data) { + console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Temp1 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp1) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhost", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp1); + } + function unSubscribeOnAcquiredCallBack_Temp1() { + console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Temp1====>"); + } + + async function FMS_acquireForm_1600_Temp1() { + console.info(`FMS_acquireForm_1600_Temp1 start`); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp1); + console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1600_Temp1 end`); + } + + function delPublishCallBack_Temp2() { + console.info("!!!====>FMS_acquireForm_1600 delPublishCallBack_Temp2====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1600 delPublishCallBack_Temp2 end'); + console.info(`FMS_acquireForm_1600 end`); + done(); + }, 500); + } + function onAcquiredCallBack_Temp2(_, data) { + console.info("!!!====>FMS_acquireForm_1600 onAcquiredCallBack_Temp2 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp2) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhost", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp2); + } + function unSubscribeOnAcquiredCallBack_Temp2() { + console.info("====>FMS_acquireForm_1600 unSubscribeOnAcquiredCallBack_Temp2====>"); + } + + async function FMS_acquireForm_1600_Temp2() { + console.info(`FMS_acquireForm_1600_Temp2 start`); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp2); + console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1600_Temp2 end`); + } + + FMS_acquireForm_1600_normal1(); + }); + /** + * @tc.number: FMS_acquireForm_1800 + * @tc.name: Multiple form hosts create one normal form and one temporary form respectively. + * @tc.desc: Verify that multiple hosts can successfully create multiple normal and temporary forms respectively. + */ + it(`FMS_acquireForm_1800`, 0, async (done) => { + console.info(`FMS_acquireForm_1800 start`); + + function delPublishCallBack_Normal1() { + console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Normal1====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1800 delPublishCallBack_Normal1 end'); + FMS_acquireForm_1800_normal2(); + }, 50); + } + function onAcquiredCallBack_Normal1(_, data) { + console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhost", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal1); + } + function unSubscribeOnAcquiredCallBack_Normal1() { + console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"); + } + + async function FMS_acquireForm_1800_normal1() { + console.info(`FMS_acquireForm_1800_normal1 start`); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); + + console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1800_normal1 end`); + } + + function delPublishCallBack_Normal2() { + console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Normal2====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1800 delPublishCallBack_Normal2 end'); + FMS_acquireForm_1800_Temp1(); + }, 50); + } + function onAcquiredCallBack_Normal2(_, data) { + console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostb", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Normal2); + } + function unSubscribeOnAcquiredCallBack_Normal2() { + console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Normal2====>"); + } + async function FMS_acquireForm_1800_normal2() { + console.info(`FMS_acquireForm_1800_normal2 start`); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); + + console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostb", + abilityName: "com.ohos.st.formsystemhostb.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1800_normal2 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1800_normal2 end`); + } + + function delPublishCallBack_Temp1() { + console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Temp1====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1800 delPublishCallBack_Temp1 end'); + FMS_acquireForm_1800_Temp2(); + }, 50); + } + function onAcquiredCallBack_Temp1(_, data) { + console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Temp1 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp1) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhost", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp1); + } + function unSubscribeOnAcquiredCallBack_Temp1() { + console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Temp1====>"); + } + + async function FMS_acquireForm_1800_Temp1() { + console.info(`FMS_acquireForm_1800_Temp1 start`); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp1); + console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1800_Temp1 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1800_Temp1 end`); + } + + function delPublishCallBack_Temp2() { + console.info("!!!====>FMS_acquireForm_1800 delPublishCallBack_Temp2====>"); + setTimeout(function () { + console.info('FMS_acquireForm_1800 delPublishCallBack_Temp2 end'); + console.info(`FMS_acquireForm_1800 end`); + done(); + }, 500); + } + function onAcquiredCallBack_Temp2(_, data) { + console.info("!!!====>FMS_acquireForm_1800 onAcquiredCallBack_Temp2 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Temp2) + var commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostb", + data: data.data + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack_Temp2); + } + function unSubscribeOnAcquiredCallBack_Temp2() { + console.info("====>FMS_acquireForm_1800 unSubscribeOnAcquiredCallBack_Temp2====>"); + } + + async function FMS_acquireForm_1800_Temp2() { + console.info(`FMS_acquireForm_1800_Temp2 start`); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Temp2); + + console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostb", + abilityName: "com.ohos.st.formsystemhostb.MainAbility", + + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1800_Temp2 featureAbility.startAbility end`); + console.info(`FMS_acquireForm_1800_Temp2 end`); + } + + FMS_acquireForm_1800_normal1(); + }); + /** + * @tc.number: FMS_acquireForm_1900 + * @tc.name: Add a temporary form when the formId is set to 0. + * @tc.desc: When the verification formId is set to 0, the temporary form is created successfully. + */ + it(`FMS_acquireForm_1900`, 0, async (done) => { + console.info(`FMS_acquireForm_1900 start`); + let formId1; + let formId2; + + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_1900 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_1900")) + formId1 = data.data; + + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err)); + }); + } + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onCreate") { + console.info("====>FMS_acquireForm_1900 onSupplyCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_1900")); + let retData = JSON.parse(data.parameters.parameters); + + let bundleName = retData.bundleName; + expect(bundleName).assertEqual("com.form.formsystemtestservicea.hmservice"); + let abilityName = retData.abilityName; + expect(abilityName).assertEqual("com.form.formsystemtestservicea.hmservice.FormAbility"); + let moduleName = retData.parameters['ohos.extra.param.key.module_name']; + expect(moduleName).assertEqual("entry"); + let formName = retData.parameters['ohos.extra.param.key.form_name']; + expect(formName).assertEqual("Form_Js001"); + let formDimension = retData.parameters['ohos.extra.param.key.form_dimension']; + expect(formDimension).assertEqual(1); + let tempFormFlag = retData.parameters['ohos.extra.param.key.form_temporary']; + expect(tempFormFlag).assertEqual(true); + formId2 = retData.parameters['ohos.extra.param.key.form_identity']; + console.info("!!!====>FMS_acquireForm_1900 onAcquiredCallBack formId2:====>" + formId2); + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err)); + }); + } + } + } + + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + + console.info(`FMS_acquireForm_1900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_1900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_1900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_1900 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_2100 + * @tc.name: When creating a temporary form, the formId is specified as the created normal formId. + * @tc.desc: Failed to create a temporary form when verifying that the formId is set to create a normal formId. + */ + it(`FMS_acquireForm_2100`, 0, async (done) => { + console.info(`FMS_acquireForm_2100 start`); + var formId; + + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2100 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallBackCache("FMS_acquireForm_2100")); + var commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_2100 publish' + JSON.stringify(err)); + }); + } + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2100 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2100")) + formId = data.data; + // add cache form + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_2100 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": data.data, + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2100 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.info(`FMS_acquireForm_2100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2100 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_2200 + * @tc.name: Cast to normal form when the temporary formId is set to negative. + * @tc.desc: Failed to Cast to normal form when the temporary formId is set to negative + */ + it(`FMS_acquireForm_2200`, 0, async (done) => { + console.info(`FMS_acquireForm_2200 start`); + + function onCastCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2200 onCastCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormCast_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2200")) + var commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_2200 publish' + JSON.stringify(err)); + }); + } + + commonEvent.subscribe(subscriberCast, onCastCallBack); + console.info(`FMS_acquireForm_2200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "temporaryId": "-1", + "castForm": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2200 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_2300 + * @tc.name: Cast to normal form when the temporary formIdis set to 0. + * @tc.desc: Failed to convert to normal form when verifying that the temporary formIdis set to 0 + */ + it(`FMS_acquireForm_2300`, 0, async (done) => { + console.info(`FMS_acquireForm_2300 start`); + + function onCastCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2300 onCastCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormCast_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2300")) + var commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_2300 publish' + JSON.stringify(err)); + }); + } + commonEvent.subscribe(subscriberCast, onCastCallBack); + console.info(`FMS_acquireForm_2300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "temporaryId": "0", + "castForm": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_2400 + * @tc.name: Non affiliated temporary form ID to normal form. + * @tc.desc: Failed to convert non affiliated temporary form ID to normal form. + */ + it(`FMS_acquireForm_2400`, 0, async (done) => { + console.info(`FMS_acquireForm_2400 start`); + + function onCastCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2400 onCastCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormCast_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2400")) + var commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_2400 publish' + JSON.stringify(err)); + }); + } + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2400 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2400")) + commonEvent.subscribe(subscriberCast, onCastCallBack); + console.info(`FMS_acquireForm_2400 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostb", + abilityName: "com.ohos.st.formsystemhostb.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "temporaryId": data.data, + "castForm": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2400 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.info(`FMS_acquireForm_2400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_2500 + * @tc.name: cast non-existent temporary formId to normal form. + * @tc.desc: Failed to verify that the temporary formId that does not exist is casted to normal form. + */ + it(`FMS_acquireForm_2500`, 0, async (done) => { + console.info(`FMS_acquireForm_2500 start`); + + function onCastCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2500 onCastCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormCast_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2500")) + var commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_2500 publish' + JSON.stringify(err)); + }); + } + commonEvent.subscribe(subscriberCast, onCastCallBack); + console.info(`FMS_acquireForm_2500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "temporaryId": "123456789", + "castForm": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_2600 + * @tc.name: When the normal form does not reach the maximum value created by the form, the temporary form changes to the normal form. + * @tc.desc: Verify that when the normal form does not reach the maximum value created by the form. + * the temporary form can be successfully casted to the normal form. + */ + it(`FMS_acquireForm_2600`, 0, async (done) => { + console.info(`FMS_acquireForm_2600 start`); + let formId1; + let formId2; + + function onCastCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2600 onCastCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormCast_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2600")) + formId1 = data.parameters.formId; + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + } + commonEvent.publish(deleteForm_Event, () => delPublishCallBack("FMS_acquireForm_2600", done)); + } + + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_2600 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2600")) + + console.info(`FMS_acquireForm_2600 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "temporaryId": data.data, + "castForm": true, + "isCreate": false + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2600 featureAbility.startAbility again end`); + } + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onCastToNormal") { + console.info("====>FMS_acquireForm_2600 onSupplyCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_2600")); + formId2 = data.parameters.parameters; + + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, () => + publishCallback1("FMS_acquireForm_2600")); + } + } + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + commonEvent.subscribe(subscriberCast, onCastCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + + console.info(`FMS_acquireForm_2600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": true, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_2600 featureAbility.startAbility end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallBack = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnErrorCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnErrorCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`====>${tcNumber} unSubscribeOnAcquiredCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.info(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} + +const unsubscribeOnErrorCallBackCache = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnErrorCallBackCache CallBack====>`); +} + +const unsubscribeOnAcquiredCallBackCache = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnAcquiredCallBackCache CallBack====>`); +} + +const unsubscribeOnCastCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnCastCallback====>`); +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/List.test.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2020ff3bcdd6db27d25fba0d8b474bfe83bfad8d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormAcquire2Test") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormAcquire2Test" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fe5a5e3bba0cd2efe51dbbc7a897140dcf4e9663 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formacquiretest2", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormAcquire2Test.hap", + "FormSystemHost.hap", + "FormSystemHostI.hap", + "FormSystemHostJ.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..8c015323574d24e6e06bc99ef13fa41a79ec2428 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.ohos.st.formacquiretest2", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formacquiretest2", + "name": ".FormAcquire2STApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormCast_commonEvent", + "reason": "need use castFrom commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..934996e9344963249339774c054dbcafc043ddab --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 40000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb5be5b983e2e6c5daec25b7371270f8c320e6e7 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets @@ -0,0 +1,501 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onErrorForm_Event = { + events: ["FMS_FormOnError_commonEvent"], +}; +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; +var subscriberFormCastEvent = { + events: ["FMS_FormCast_commonEvent"], +}; +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnError; +var subscriberOnAcquired; +var subscriberCast; +var subscriberSupply; + +export default function test() { + describe(`FmsAcquiredFormTest2`, () => { + + beforeEach(async () => { + subscriberOnError = await commonEvent.createSubscriber(onErrorForm_Event); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberCast = await commonEvent.createSubscriber(subscriberFormCastEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + }) + + /** + * @tc.number: FMS_acquireForm_3800 + * @tc.name: Failed to add form when parameter ability is wrong. + * @tc.desc: Failed to create form when verifying that the parameter (formId) of creating form is wrong. + */ + it(`FMS_acquireForm_3800`, 0, async (done) => { + console.info(`FMS_acquireForm_3800 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_3800 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_3800")); + console.info(`FMS_acquireForm_3800 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_3800 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_3800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_3800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_3800 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_acquireForm_3900 + * @tc.name: Failed to add form when parameter bundleName is wrong. + * @tc.desc: Failed to create form when verifying that the parameter (bundleName) of creating form is wrong. + */ + it(`FMS_acquireForm_3900`, 0, async (done) => { + console.info(`FMS_acquireForm_3900 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_3900 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_3900")); + console.info(`FMS_acquireForm_3900 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_3900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_3900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_3900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_3900 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_4000 + * @tc.name: When the form specifications are inconsistent, creating the cached form fails. + * @tc.desc: Return failed. + */ + it(`FMS_acquireForm_4000`, 0, async (done) => { + console.info(`FMS_acquireForm_4000 start`); + var formId; + + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4000 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4000")); + expect(data.data).assertEqual("the form id and form config are not matched."); + + console.info(`FMS_acquireForm_4000 end`); + var commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_acquireForm_4000 publish' + JSON.stringify(err)); + }); + } + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4000 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4000")) + formId = data.data; + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + + console.info(`FMS_acquireForm_4000 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": data.data, + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "dimension": "2", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4000 featureAbility.startAbility again end`); + } + function unSubscribeOnAcquiredCallback() { + console.info("====>FMS_acquireForm_4000 OnAcquired UnSubscribe CallBack====>"); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.info(`FMS_acquireForm_4000 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "dimension": "1", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4000 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_4100 + * @tc.name: Failed to add form when parameter moduleName is wrong. + * @tc.desc: Failed to create form when verifying that the parameter (moduleName) of creating form is wrong. + */ + it(`FMS_acquireForm_4100`, 0, async (done) => { + console.info(`FMS_acquireForm_4100 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4100 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + expect(data.data).assertEqual("invalid params received on operating form."); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4100")); + console.info(`FMS_acquireForm_4100 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_4100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostj", + abilityName: "com.ohos.st.formsystemhostj.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4100 featureAbility.startAbility end`); + }); + + + /** + * @tc.number: FMS_acquireForm_4200 + * @tc.name: Success to add form when parameter formName is blank. + * @tc.desc: Success to create form when verifying that the parameter (formName) of creating form is success. + */ + it(`FMS_acquireForm_4200`, 0, async (done) => { + console.info(`FMS_acquireForm_4200 start`); + let formId1; + let formId2; + + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4200 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4200")) + formId1 = data.data; + + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack('FMS_acquireForm_4200', done)); + } + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onCreate") { + console.info("====>FMS_acquireForm_4200 onSupplyCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_acquireForm_4200")); + let retData = JSON.parse(data.parameters.parameters); + + let formName = retData.parameters['ohos.extra.param.key.form_name']; + expect(formName).assertEqual("Form_Js001"); + formId2 = retData.parameters['ohos.extra.param.key.form_identity']; + console.info("!!!====>FMS_acquireForm_4200 onAcquiredCallBack formId2:====>" + formId2); + if (formId1 && formId2) { + expect(formId1).assertEqual(formId2); + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack('FMS_acquireForm_4200', done)); + } + } + } + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.info(`FMS_acquireForm_4200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.info(`FMS_acquireForm_4200 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_4300 + * @tc.name: Success to add form when parameter dimension is passed. + * @tc.desc: Success to create form when verifying that the parameter (dimension) of creating form. + */ + it(`FMS_acquireForm_4300`, 0, async (done) => { + console.info(`FMS_acquireForm_4300 start`); + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4300 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4300")); + console.info(`FMS_acquireForm_4300 end`); + done(); + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.info(`FMS_acquireForm_4300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhosti", + abilityName: "com.ohos.st.formsystemhosti.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4300 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_4400 + * @tc.name: Failed to add form when parameter dimension is not exist. + * @tc.desc: Failed to create form when verifying that the parameter (dimension) of creating form is wrong. + */ + it(`FMS_acquireForm_4400`, 0, async (done) => { + console.info(`FMS_acquireForm_4400 start`); + function onErrorCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4400 onErrorCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4400")); + expect(data.data).assertEqual("the dimension not exist in the form."); + console.info(`FMS_acquireForm_4400 end`); + done(); + } + commonEvent.subscribe(subscriberOnError, onErrorCallBack); + console.info(`FMS_acquireForm_4400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhosti", + abilityName: "com.ohos.st.formsystemhosti.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "dimension": "6", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4400 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_acquireForm_4900 + * @tc.name: Cast temp form when the formId is created formId. + * @tc.desc: When the verification formId is set to 0, the form is created failed. + */ + it(`FMS_acquireForm_4900`, 0, async (done) => { + console.info(`FMS_acquireForm_4900 start`); + + function onCastCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4900 onCastCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormCast_commonEvent"); + expect(data.data).assertEqual("9"); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_4900")) + var commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData,(err) => { + console.info('FMS_acquireForm_4900 publish' + JSON.stringify(err)); + }); + } + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_acquireForm_4900 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_4900")) + commonEvent.subscribe(subscriberCast, onCastCallBack); + + console.info(`FMS_acquireForm_4900 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "temporaryId": data.data, + "castForm": true, + "isCreate": false + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4900 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.info(`FMS_acquireForm_4900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhost", + abilityName: "com.ohos.st.formsystemhost.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicea.hmservice", + "ability": "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`FMS_acquireForm_4900 featureAbility.startAbility end`); + }); + + }); +} + + +const delPublishCallBack = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnErrorCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnErrorCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`====>${tcNumber} unSubscribeOnAcquiredCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.info(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} + +const unsubscribeOnCastCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnCastCallback====>`); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..73f06334638559488232031fa15b6945f96829bc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsAcquireForm2.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3fd7831c6173babb5cb572e4041b0ecc7b6d7d7b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formacquiretest2" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8ceff4401121ed76f0685f43723e55e8ad954403 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormDeleteTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormDeleteTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f004fd4342be2787b9233d86904451a61773a781 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formdeletetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormDeleteTest.hap", + "FormSystemHostC.hap", + "FormSystemHostD.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap", + "FormSupplyAppB.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ec7ce2d67c2b0adc3a0d326487f4d4ca61477d6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 10000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..09f8642cc87b888eeef99a6b36795fc8a9e23b24 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets @@ -0,0 +1,1178 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import commonEvent from '@ohos.commonEvent'; +import systemTime from '@ohos.systemTime'; +import { beforeEach, describe, expect, it } from 'deccjsunit/index'; + +const onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; +const onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; +const onReleasedFormEvent = { + events: ["FMS_FormOnReleased_commonEvent"], +}; +const onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +const deleteForm_Event = "FMS_FormDelete_commonEvent"; + +let subscriberOnAcquired; +let subscriberOnReleased; +let subscriberOnDeleted; +let subscriberSupply; + +export default function test() { + describe(`FmsDeleteFormTest`, () => { + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); + subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }); + + /** + * @tc.number: FMS_deleteForm_0200 + * @tc.name: host does not have permission + * @tc.desc: 1.delete the form that formID is 1 + * 2.Verify the result is false + */ + it(`FMS_deleteForm_0200`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0200`; + let formId; + + const onDeletedCallback = async (_, data) => { + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); + const commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_deleteForm_0200 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: formId, + isCreate: false + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0300 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.delete the form + * 2.Verify the result is false + */ + it(`FMS_deleteForm_0300`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0300`; + + const onDeletedCallback = async (_, data) => { + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); + const commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_deleteForm_0300 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: "-1", + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0400 + * @tc.name: formID id is error(formID = 0) + * @tc.desc: 1.delete the form + * 2.Verify the result is false + */ + it(`FMS_deleteForm_0400`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0400`; + + const onDeletedCallback = async (_, data) => { + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); + const commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_deleteForm_0400 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: "0", + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0500 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.host A create a formA + * 2.host B delete the formA + * 2.Verify the result is false + */ + it(`FMS_deleteForm_0500`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0500`; + let formId; + + const onDeletedCallback = async (_, data) => { + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); + const commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_deleteForm_0500 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: formId, + isCreate: false + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0600 + * @tc.name: Delete a normal form and the form reference is not 0 after deletion + * @tc.desc: 1.host A create a normal formA + * 2.host B create a form with formA's ID + * 3.delete formA, and verify the result is true + */ + it(`FMS_deleteForm_0600`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0600`; + let formId; + let supplyFlag = false; + + async function delPublishCallback() { + console.info(`${tcNumber} delPublishCallback`); + await sleep(1000); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + if (supplyFlag) { + deleteFormB(); + expect().assertFail(); + } else { + deleteFormB(); + } + console.info(`${tcNumber} delPublishCallback end`); + } + + async function delPublishCallbackB() { + console.info(`${tcNumber} delPublishCallbackB`); + await sleep(500); + console.info(`${tcNumber} delPublishCallbackB end`); + console.info(`${tcNumber} end`); + done(); + } + + function deleteFormB() { + console.info(`${tcNumber} deleteFormB start`); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostd", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); + console.info(`${tcNumber} deleteFormB end`); + } + + const onAcquiredCallbackB = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + expect(data.data).assertEqual(formId); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + }; + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + await sleep(1000); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + formId: formId, + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + const onSupplyCallback = async (_, data) => { + if (data.parameters.kind == "onDestroy") { + console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); + supplyFlag = true; + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0700 + * @tc.name: After deleting a normal form, the form reference is 0. + * After deleting a form, there are still created normal forms in FMS. + * @tc.desc: 1.host A an host B create one normal card respectively + * 2.host A delete the form and verify the result is true + */ + it(`FMS_deleteForm_0700`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0700`; + let formId; + let formIdB; + let supplyFlag = false; + + async function delPublishCallback() { + console.info(`${tcNumber} delPublishCallback`); + await sleep(1000); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + if (supplyFlag) { + deleteFormB(); + } else { + deleteFormB(); + expect().assertFail(); + } + console.info(`${tcNumber} delPublishCallback end`); + } + + async function delPublishCallbackB() { + console.info(`${tcNumber} delPublishCallbackB`); + await sleep(1000); + console.info(`${tcNumber} delPublishCallbackB end`); + console.info(`${tcNumber} end`); + done(); + } + + function deleteFormB() { + console.info(`${tcNumber} deleteFormB start`); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostd", + data: formIdB + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); + console.info(`${tcNumber} deleteFormB end`); + } + + const onAcquiredCallbackB = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + formIdB = data.data; + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + }; + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + await sleep(1000); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + const onSupplyCallback = async (_, data) => { + if (data.parameters.kind == "onDestroy") { + console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); + expect(data.parameters.parameters).assertEqual(formId); + supplyFlag = true; + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0700_1 + * @tc.name: After deleting a normal form, the form reference is 0. + * After deleting a form, there are still created normal forms in FMS. + * @tc.desc: 1.host A an host B create one normal card respectively + * 2.host A delete the form and verify the result is true + */ + it(`FMS_deleteForm_0700_1`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0700_1`; + let formId; + let formIdB; + let supplyFlag = false; + let supplyFlagUpdate = false; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 900 }, () => { + console.info(`${tcNumber} time speed up`); + }); + await changeTime(10, 29, 55); + + async function delPublishCallback() { + console.info(`${tcNumber} delPublishCallback`); + await sleep(5000); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + if (supplyFlag && supplyFlagUpdate) { + deleteFormB(); + } else { + deleteFormB(); + expect().assertFail(); + } + console.info(`${tcNumber} delPublishCallback end`); + } + + async function delPublishCallbackB() { + console.info(`${tcNumber} delPublishCallbackB`); + await sleep(1000); + console.info(`${tcNumber} delPublishCallbackB end`); + console.info(`${tcNumber} end`); + done(); + } + + async function deleteFormB() { + console.info(`${tcNumber} deleteFormB start`); + // timer speed reset + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.info(`${tcNumber} time speed up`); + }); + await sleep(1000); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formIdB + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); + console.info(`${tcNumber} deleteFormB end`); + } + + const onAcquiredCallbackB = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + formIdB = data.data; + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostd", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + }; + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + await sleep(1000); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + const onSupplyCallback = async (_, data) => { + if (data.parameters.kind == "onDestroy") { + console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); + expect(data.parameters.parameters).assertEqual(formId); + supplyFlag = true; + } + if (data.parameters.kind == "onUpdate") { + if (data.parameters.parameters == formId) { + expect().assertFail(); + } else if (data.parameters.parameters == formIdB) { + supplyFlagUpdate = true; + } + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + formId: "0", + name: "Form_Js002", + bundle: "com.form.formsystemtestserviceb.hmservice", + ability: "com.form.formsystemtestserviceb.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0700_2 + * @tc.name: After deleting a normal form, the form reference is 0. + * After deleting a form, there are still created normal forms in FMS. + * @tc.desc: 1.host A an host B create one normal card respectively + * 2.host A delete the form and verify the result is true + */ + it(`FMS_deleteForm_0700_2`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0700_2`; + let formId; + let formIdB; + let supplyFlag = false; + let supplyFlagUpdate = false; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 900 }, () => { + console.info(`${tcNumber} time speed up`); + }); + await changeTime(10, 29, 55); + async function delPublishCallback() { + console.info(`${tcNumber} delPublishCallback`); + await sleep(5000); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + if (supplyFlag && supplyFlagUpdate) { + deleteFormB(); + } else { + deleteFormB(); + expect().assertFail(); + } + console.info(`${tcNumber} delPublishCallback end`); + } + + async function delPublishCallbackB() { + console.info(`${tcNumber} delPublishCallbackB`); + await sleep(1000); + console.info(`${tcNumber} delPublishCallbackB end`); + console.info(`${tcNumber} end`); + done(); + } + + async function deleteFormB() { + console.info(`${tcNumber} deleteFormB start`); + // timer speed reset + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.info(`${tcNumber} time speed up`); + }); + await sleep(1000); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostd", + data: formIdB + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); + console.info(`${tcNumber} deleteFormB end`); + } + + const onAcquiredCallbackB = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + formIdB = data.data; + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + }; + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + await sleep(1000); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + formId: "0", + name: "Form_Js002", + bundle: "com.form.formsystemtestserviceb.hmservice", + ability: "com.form.formsystemtestserviceb.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + const onSupplyCallback = async (_, data) => { + if (data.parameters.kind == "onDestroy") { + console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); + expect(data.parameters.parameters).assertEqual(formId); + supplyFlag = true; + } + if (data.parameters.kind == "onUpdate") { + if (data.parameters.parameters == formId) { + expect().assertFail(); + } else if (data.parameters.parameters == formIdB) { + supplyFlagUpdate = true; + } + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_0900 + * @tc.name: Form ID error (FormID does not exist) + * @tc.desc: 1.host create one normal card + * 2.host delete the form + * 3.host delete the form again and verify the result is false + */ + it(`FMS_deleteForm_0900`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_0900`; + let formId; + + function onDeletedCallback2(_, data) { + console.info(`${tcNumber} onDeletedCallback2 data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data != "0").assertEqual(true); + console.info(`${tcNumber} failed to delete form again.`); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_deleteForm_0900 publish' + JSON.stringify(err)); + }); + } + + const onDeletedCallback = async (_, data) => { + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data).assertEqual(`0`); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeOnDeletedCallback(tcNumber)); + formId = data.parameters.formId; + subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); + await sleep(1000); + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback2); + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: formId, + isCreate: false + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: "self", + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_1000 + * @tc.name: You can delete a card after releasing it + * @tc.desc: 1.host create one normal card + * 2.host release the form + * 3.host delete the form and verify the result is true + */ + it(`FMS_deleteForm_1000`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_1000`; + let formId; + + async function onReleasedCallback(_, data) { + console.info(`${tcNumber} onReleasedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnReleased_commonEvent`); + expect(data.data).assertEqual(`0`); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback(tcNumber)); + formId = data.parameters.formId; + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + deleteId: formId, + isCreate: false + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnReleased, onReleasedCallback); + + const onSupplyCallback = async (_, data) => { + if (data.parameters.kind == "onDestroy") { + console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + expect(data.parameters.parameters).assertEqual(formId); + await sleep(1000); + console.info(`${tcNumber}onDeletedCallback end`); + console.info(`${tcNumber} end`); + done(); + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: false, + "releaseForm": true, + "releaseId": "self", + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_deleteForm_1100 + * @tc.name: When deleting a temporary form, cache data is deleted. + * @tc.desc: 1.host a and b create one temporary card respectively + * 2.host a delete the form and verify the result is true + */ + it(`FMS_deleteForm_1100`, 0, async (done) => { + const tcNumber = `FMS_deleteForm_1100`; + let formId; + let formIdB; + let supplyFlag = false; + + async function delPublishCallback() { + console.info(`${tcNumber} delPublishCallback`); + await sleep(1000); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + if (supplyFlag) { + deleteFormB(); + } else { + deleteFormB(); + expect().assertFail(); + } + console.info(`${tcNumber} delPublishCallback end`); + } + + async function delPublishCallbackB() { + console.info(`${tcNumber} delPublishCallbackB`); + await sleep(1000); + console.info(`${tcNumber} delPublishCallbackB end`); + console.info(`${tcNumber} end`); + done(); + } + + function deleteFormB() { + console.info(`${tcNumber} deleteFormB start`); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostd", + data: formIdB + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallbackB); + console.info(`${tcNumber} deleteFormB end`); + } + + const onAcquiredCallbackB = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallbackB data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + formIdB = data.data; + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + }; + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + await sleep(1000); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallbackB); + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: true, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + const onSupplyCallback = async (_, data) => { + if (data.parameters.kind == "onDestroy") { + console.info(`${tcNumber} onSupplyCallback ${JSON.stringify(data)}`); + expect(data.parameters.parameters).assertEqual(formId); + supplyFlag = true; + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.FormAbility", + moduleName: "entry", + temporary: true, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + }); +} + +/** + * Set time + * + * @param hour hour of 24H clock + * @param min minute + * @param second second + */ +const changeTime = async (hour, min, second) => { + console.info(`FMS_deleteForm changeTime start`); + const datetime = new Date(); + const year = datetime.getFullYear(); + const month = datetime.getMonth() + 1; + const day = datetime.getDate(); + const formatTime = year + '-' + fill(month) + '-' + fill(day) + + 'T' + fill(hour) + ':' + fill(min) + ':' + fill(second); + const s = (new Date(formatTime)).getTime(); + console.info(`FMS_deleteForm changeTime formatTime: ${formatTime}`); + console.info(`FMS_deleteForm changeTime s: ${s}`); + + try { + await systemTiem.setTime(s); + console.info(`FMS_deleteForm set time success: ${formatTime}`); + } catch (error) { + console.info(`FMS_deleteForm set time failure: ${error}`); + } + console.info(`FMS_deleteForm changeTime end`); +}; + +const fill = value => { + return (value > 9 ? "" : "0") + value; +}; + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + await sleep(1000); + console.info(`${tcNumber} delPublishCallback end`); + console.info(`${tcNumber} end`); + done(); +}; + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe OnAcquired Callback`); +}; + +const unsubscribeOnDeletedCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe OnDeleted Callback`); +}; + +const unsubscribeSupplyCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe Supply Callback`); +}; + +const unsubscribeOnReleasedCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe OnReleased Callback`); +}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/List.test.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..66399f5e26d93a3aeb397acb9792ccc6ba9b8518 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormDynamicRefreshTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormDynamicRefreshTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6e016602f77566e7becf42c94a99558fcc54da78 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/Test.json @@ -0,0 +1,22 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formdynamicrefreshtest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormDynamicRefreshTest.hap", + "FormSystemHostE.hap", + "FormSystemHostF.hap", + "FormSupplyAppA.hap", + "FormSupplyAppC.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd535b4d476a15433fc062a0416c86f3e389c7c3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..22aaf1dd8c8acff6c9f316965bc80f5b0b2378a1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets @@ -0,0 +1,448 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import commonEvent from '@ohos.commonEvent'; +import { beforeEach, describe, expect, it } from 'deccjsunit/index'; + +const onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; + +const onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; + +const onRefreshFormEvent = { + events: ["FMS_FormDynamicRefresh_commonEvent"], +}; + +const onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +const deleteForm_Event = "FMS_FormDelete_commonEvent"; + +let subscriberOnAcquired; +let subscriberOnDeleted; +let subscriberOnRefresh; +let subscriberSupply; + +export default function test() { + describe(`FmsTimeRefreshFormTest`, () => { + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberOnRefresh = await commonEvent.createSubscriber(onRefreshFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }); + + /** + * @tc.number: FMS_timedRefresh_0100 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. + * 2.Verify the result of the dynamic timed refresh interface. + */ + it(`FMS_timedRefresh_0100`, 0, async (done) => { + const tcNumber = `FMS_timedRefresh_0100`; + + const onRefreshCallback = async (_, data) => { + console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); + expect(data.data).assertEqual(`7`); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); + const commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_timedRefresh_0100 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + refreshForm: true, + refreshId: "-1", + refreshTime: 5, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_timedRefresh_0200 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. + * 2.Verify the result of the dynamic timed refresh interface. + */ + it(`FMS_timedRefresh_0200`, 0, async (done) => { + const tcNumber = `FMS_timedRefresh_0200`; + + const onRefreshCallback = async (_, data) => { + console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); + expect(data.data).assertEqual(`7`); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); + const commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_timedRefresh_0200 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + refreshForm: true, + refreshId: "0", + refreshTime: 5, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_timedRefresh_0300 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form provider B to invoke the dynamic timed refresh interface. + * 2.Verify the result of the dynamic timed refresh interface. + */ + it(`FMS_timedRefresh_0300`, 0, async (done) => { + const tcNumber = `FMS_timedRefresh_0300`; + let formId; + + const onRefreshCallback = async (_, data) => { + console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); + expect(data.data).assertEqual(`13`); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); + const commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_timedRefresh_0300 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); + + const onAcquiredCallback = async (_, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnAcquired_commonEvent`); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback(tcNumber)); + formId = data.data; + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + refreshForm: true, + refreshId: formId, + refreshTime: 5, + isCreate: false + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_timedRefresh_0400 + * @tc.name: Form ID error (FormID does not exist) + * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. + * 2.Verify the result of the dynamic timed refresh interface. + */ + it(`FMS_timedRefresh_0400`, 0, async (done) => { + const tcNumber = `FMS_timedRefresh_0400`; + let formId; + + const onRefreshCallback = async (_, data) => { + console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); + expect(data.data).assertEqual(`9`); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); + const commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_timedRefresh_0400 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); + + const onDeletedCallback = async (_, data) => { + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormOnDeleted_commonEvent`); + expect(data.data).assertEqual(`0`); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeDeletedCallback(tcNumber)); + formId = data.parameters.formId; + + console.info(`${tcNumber} featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + refreshForm: true, + refreshId: formId, + refreshTime: 5, + isCreate: false + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility again end`); + }; + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + deleteForm: true, + "deleteId": "self", + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_timedRefresh_0500 + * @tc.name: Incorrect interval for the next refresh (time < 5) + * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. + * 2.Verify the result of the dynamic timed refresh interface. + */ + it(`FMS_timedRefresh_0500`, 0, async (done) => { + const tcNumber = `FMS_timedRefresh_0500`; + + const onRefreshCallback = async (_, data) => { + console.info(`${tcNumber} onRefreshCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormDynamicRefresh_commonEvent`); + expect(data.data).assertEqual(`7`); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback(tcNumber)); + const commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_timedRefresh_0500 publish' + JSON.stringify(err)); + }); + }; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicea.hmservice", + ability: "com.form.formsystemtestservicea.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + refreshForm: true, + refreshId: "self", + refreshTime: 1, + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_timedRefresh_0600 + * @tc.name: correct interval for the next refresh (time == 5) + * @tc.desc: 1.The form provider A to invoke the dynamic timed refresh interface. + * 2.Verify the result of the dynamic timed refresh interface. + */ + it(`FMS_timedRefresh_0600`, 0, async (done) => { + const tcNumber = `FMS_timedRefresh_0600`; + + const onSupplyCallback = async (_, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}`); + expect(data.event).assertEqual(`FMS_FormSupply_commonEvent`); + if (data.parameters.kind == "onVisibilityChange") { + console.info(`${tcNumber} onSupplyCallback kind: data.parameters.kind`); + console.info(`${tcNumber} onSupplyCallback error: data.parameters.errorData`); + expect(data.parameters.errorData).assertEqual(`0`); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback(tcNumber)); + const commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_timedRefresh_0600 publish' + JSON.stringify(err)); + }); + } + }; + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + + console.info(`${tcNumber} featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + formId: "0", + name: "Form_Js001", + bundle: "com.form.formsystemtestservicec.hmservice", + ability: "com.form.formsystemtestservicec.hmservice.MainAbility", + moduleName: "entry", + temporary: false, + "notifyVisibleForms": true, + "notifyVisibleId": "self", + isCreate: true + } + } + }).then((res: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.info(`${tcNumber} featureAbility.startAbility end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + await sleep(1000); + console.info(`${tcNumber} delPublishCallback end`); + console.info(`${tcNumber} end`); + done(); +}; + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe OnAcquired Callback`); +}; + +const unsubscribeDeletedCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe Deleted Callback`); +}; + +const unsubscribeSupplyCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe Supply Callback`); +}; + +const unsubscribeOnRefreshCallback = (tcNumber) => { + console.info(`${tcNumber} Unsubscribe OnRefresh Callback`); +}; diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/BUILD.gn rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/BUILD.gn diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3284745911b025ce31a8866b4c3b186fdb0be6be --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.ohos.st.formfuzztest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormFuzzTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d571123825ec0f228a7d230e9e84aa3ab337a29f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a531fcd34e8b57698b7d8e5474af36e0aff1b378 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + private componentName: string = `FormSystemFuzzTest`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`${this.componentName}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/CastTempFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/CastTempFormFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b997fc8dd77e56f28320ea5b4c73b8a2c2038c3f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/CastTempFormFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const castTempFormFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_casttempform`; + const promiseName = `FMS_fuzzTest_casttempform`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_casttempform_0100 ~ FMS_fuzzTest_casttempform_0800 + * @tc.desc Check whether the castTempForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + try { + formHost.castTempForm(formId, (error, data) => { + console.log(`${callbackName} ${tcNumber} castTempForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_casttempform_0900 ~ FMS_fuzzTest_casttempform_1600 + * @tc.desc Check whether the castTempForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); + try { + const data = await formHost.castTempForm(formId); + console.log(`${promiseName} ${tcNumber} castTempForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DeleteFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DeleteFormFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fba18a42b90384a61c8241ff6b82e9bfecaa89a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DeleteFormFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const deleteFormFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_deleteform`; + const promiseName = `FMS_fuzzTest_deleteform`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_deleteform_0100 ~ FMS_fuzzTest_deleteform_0800 + * @tc.desc Check whether the deleteForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + try { + formHost.deleteForm(formId, (error, data) => { + console.log(`${callbackName} ${tcNumber} deleteForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_deleteform_0900 ~ FMS_fuzzTest_deleteform_1600 + * @tc.desc Check whether the deleteForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); + try { + const data = await formHost.deleteForm(formId); + console.log(`${promiseName} ${tcNumber} deleteForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DisableFormsUpdateFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DisableFormsUpdateFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad04207a513f6a9c7d9ed7f1f231d88b418d0833 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/DisableFormsUpdateFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const disableFormsUpdateFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_disable`; + const promiseName = `FMS_fuzzTest_disable`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_disable_0100 ~ FMS_fuzzTest_disable_0800 + * @tc.desc Check whether the disableFormsUpdate interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); + try { + formHost.disableFormsUpdate(formIds, (error, data) => { + console.log(`${callbackName} ${tcNumber} disableFormsUpdate data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_disable_0900 ~ FMS_fuzzTest_disable_1600 + * @tc.desc Check whether the disableFormsUpdate interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); + try { + const data = await formHost.disableFormsUpdate(formIds); + console.log(`${promiseName} ${tcNumber} disableFormsUpdate data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/EnableFormsUpdateFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/EnableFormsUpdateFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d70f2d1cf437147fa788cef5a6b20d68d91011b8 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/EnableFormsUpdateFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const enableFormsUpdateFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_enable`; + const promiseName = `FMS_fuzzTest_enable`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_enable_0100 ~ FMS_fuzzTest_enable_0800 + * @tc.desc Check whether the enableFormsUpdate interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); + try { + formHost.enableFormsUpdate(formIds, (error, data) => { + console.log(`${callbackName} ${tcNumber} enableFormsUpdate data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_enable_0900 ~ FMS_fuzzTest_enable_1600 + * @tc.desc Check whether the enableFormsUpdate interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); + try { + const data = await formHost.enableFormsUpdate(formIds); + console.log(`${promiseName} ${tcNumber} enableFormsUpdate data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6b305b3568c8807bda51128392946550910c5b0 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets @@ -0,0 +1,233 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const getFormsInfoFuzzTest = (describeName, filterParameter) => { + const ERR_GET_BUNDLE_FAILED_CODE = 5; + const ERR_GET_BUNDLE_FAILED = `failed to obtain the bundle information`; + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_getinfobundle`; + const promiseName = `FMS_fuzzTest_getinfobundle`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_getinfobundle_0100 ~ FMS_fuzzTest_getinfobundle_0800 + * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const bundleName = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} bundleName typeof: ${typeof bundleName}`); + try { + formHost.getFormsInfo(bundleName, (error, data) => { + console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_getinfobundle_0900 ~ FMS_fuzzTest_getinfobundle_1600 + * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const bundleName = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} bundleName typeof: ${typeof bundleName}`); + try { + const data = await formHost.getFormsInfo(bundleName); + console.log(`${promiseName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + } + }); + } + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_getinfomodule`; + const promiseName = `FMS_fuzzTest_getinfomodule`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_getinfomodule_0100 ~ FMS_fuzzTest_getinfomodule_0800 + * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const bundleName = getFuzzData(dataType); + const moduleName = `com.test.module_name_${tcNumber}`; + console.log(`${callbackName} ${tcNumber} bundleName typeof: ${typeof bundleName}`); + console.log(`${callbackName} ${tcNumber} moduleName typeof: ${typeof moduleName}`); + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_getinfomodule_0900 ~ FMS_fuzzTest_getinfomodule_1600 + * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const bundleName = getFuzzData(dataType); + const moduleName = `com.test.module_name_${tcNumber}`; + console.log(`${promiseName} ${tcNumber} ${describeName} bundleName typeof: ${typeof bundleName}`); + console.log(`${promiseName} ${tcNumber} ${describeName} moduleName typeof: ${typeof moduleName}`); + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 2) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_getinfomodule_1700 ~ FMS_fuzzTest_getinfomodule_2400 + * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const bundleName = `com.test.bundle_name_${tcNumber}`; + const moduleName = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} bundleName typeof: ${typeof bundleName}`); + console.log(`${callbackName} ${tcNumber} moduleName typeof: ${typeof moduleName}`); + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 3) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_getinfomodule_2500 ~ FMS_fuzzTest_getinfomodule_3200 + * @tc.desc Check whether the getFormsInfo interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const bundleName = `com.test.bundle_name_${tcNumber}`; + const moduleName = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} bundleName typeof: ${typeof bundleName}`); + console.log(`${promiseName} ${tcNumber} ${describeName} moduleName typeof: ${typeof moduleName}`); + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + } + }); + } + }) +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe031251d8fe8bef71b96752fd7ee28263772bae --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,61 @@ +/* + * 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 { castTempFormFuzzTest } from './CastTempFormFuzz.test.ets'; +import { deleteFormFuzzTest } from './DeleteFormFuzz.test.ets'; +import { disableFormsUpdateFuzzTest } from './DisableFormsUpdateFuzz.test.ets'; +import { enableFormsUpdateFuzzTest } from './EnableFormsUpdateFuzz.test.ets'; +import { getFormsInfoFuzzTest } from './GetFormsInfoFuzz.test.ets'; +import { notifyInvisibleFormsFuzzTest } from './NotifyInvisibleFormsFuzz.test.ets'; +import { notifyVisibleFormsFuzzTest } from './NotifyVisibleFormsFuzz.test.ets'; +import { releaseFormFuzzTest } from './ReleaseFormFuzz.test.ets'; +import { requestFormFuzzTest } from './RequestFormFuzz.test.ets'; +import { setFormNextRefreshTimeFuzzTest } from './SetFormNextRefreshTimeFuzz.test.ets'; +import { updateFormFuzzTest } from './UpdateFormFuzz.test.ets'; + +export default function testsuite() { + // FMS_fuzzTest_deleteform + deleteFormFuzzTest(`DeleteFormFuzzTest`, 0); + + // FMS_fuzzTest_releaseform + releaseFormFuzzTest(`ReleaseFormFuzzTest`, 0); + + // FMS_fuzzTest_casttempform + castTempFormFuzzTest(`CastTempFormFuzzTest`, 0); + + // FMS_fuzzTest_invisible + notifyVisibleFormsFuzzTest(`NotifyVisibleFormsFuzzTest`, 0); + + // FMS_fuzzTest_visible + notifyInvisibleFormsFuzzTest(`NotifyInvisibleFormsFuzzTest`, 0); + + // FMS_fuzzTest_requestform + requestFormFuzzTest(`RequestFormFuzzTest`, 0); + + // FMS_fuzzTest_updateform + updateFormFuzzTest(`UpdateFormFuzzTest`, 0); + + // FMS_fuzzTest_setnexttime + setFormNextRefreshTimeFuzzTest(`SetFormNextRefreshTimeFuzzTest`, 0); + + // FMS_fuzzTest_enable + enableFormsUpdateFuzzTest(`EnableFormsUpdateFuzzTest`, 0); + + // FMS_fuzzTest_disable + disableFormsUpdateFuzzTest(`DisableFormsUpdateFuzzTest`, 0); + + // FMS_fuzzTest_getinfobundle + // FMS_fuzzTest_getinfomodule + getFormsInfoFuzzTest(`GetFormsInfoFuzzTest`, 0); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyInvisibleFormsFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyInvisibleFormsFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..226974fb49f12ed1f5fb82389e104d60e6e9a0ec --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyInvisibleFormsFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const notifyInvisibleFormsFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_invisible`; + const promiseName = `FMS_fuzzTest_invisible`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_invisible_0100 ~ FMS_fuzzTest_invisible_0800 + * @tc.desc Check whether the notifyInvisibleForms interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); + try { + formHost.notifyInvisibleForms(formIds, (error, data) => { + console.log(`${callbackName} ${tcNumber} notifyInvisibleForms data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_invisible_0900 ~ FMS_fuzzTest_invisible_1600 + * @tc.desc Check whether the notifyInvisibleForms interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); + try { + const data = await formHost.notifyInvisibleForms(formIds); + console.log(`${promiseName} ${tcNumber} notifyInvisibleForms data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyVisibleFormsFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyVisibleFormsFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d16eb88f47f95c723b184b2e8058d63d09b84e75 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/NotifyVisibleFormsFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const notifyVisibleFormsFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_visible`; + const promiseName = `FMS_fuzzTest_visible`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_visible_0100 ~ FMS_fuzzTest_visible_0800 + * @tc.desc Check whether the notifyVisibleForms interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formIds typeof: ${typeof formIds}`); + try { + formHost.notifyVisibleForms(formIds, (error, data) => { + console.log(`${callbackName} ${tcNumber} notifyVisibleForms data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_visible_0900 ~ FMS_fuzzTest_visible_1600 + * @tc.desc Check whether the notifyVisibleForms interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formIds = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formIds typeof: ${typeof formIds}`); + try { + const data = await formHost.notifyVisibleForms(formIds); + console.log(`${promiseName} ${tcNumber} notifyVisibleForms data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/ReleaseFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/ReleaseFormFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b2fc1b2004963dc3d4fab41d094ef06a6a994e5 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/ReleaseFormFuzz.test.ets @@ -0,0 +1,218 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const releaseFormFuzzTest = (describeName, filterParameter) => { + const ERR_COMMON_CODE = 1; + const ERR_COMMON = `internal error`; + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + const ERR_NOT_EXIST_ID_CODE = 9; + const ERR_NOT_EXIST_ID = `the ID of the form to be operated does not exist`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_releaseform`; + const promiseName = `FMS_fuzzTest_releaseform`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_releaseform_0100 ~ FMS_fuzzTest_releaseform_0800 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + try { + formHost.releaseForm(formId, (error, data) => { + console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_releaseform_0900 ~ FMS_fuzzTest_releaseform_1600 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); + try { + const data = await formHost.releaseForm(formId); + console.log(`${promiseName} ${tcNumber} releaseForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 2) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_releaseform_1700 ~ FMS_fuzzTest_releaseform_2400 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + const isReleaseCache = true; + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${callbackName} ${tcNumber} isReleaseCache typeof: ${typeof isReleaseCache}`); + try { + formHost.releaseForm(formId, isReleaseCache, (error, data) => { + console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 3) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_releaseform_2500 ~ FMS_fuzzTest_releaseform_3200 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + const isReleaseCache = true; + console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); + console.log(`${promiseName} ${tcNumber} ${describeName} isReleaseCache typeof: ${typeof isReleaseCache}`); + try { + const data = await formHost.releaseForm(formId, isReleaseCache); + console.log(`${promiseName} ${tcNumber} releaseForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`STRING` === dataType) { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } else { + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } + done(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 4) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_releaseform_3300 ~ FMS_fuzzTest_releaseform_4000 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = `${tcNumber}`; + const isReleaseCache = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${callbackName} ${tcNumber} isReleaseCache typeof: ${typeof isReleaseCache}`); + try { + formHost.releaseForm(formId, isReleaseCache, (error, data) => { + console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + if (`BOOLEAN` === dataType) { + expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE); + expect(error.message).assertEqual(ERR_NOT_EXIST_ID); + } else { + expect(error.code).assertEqual(ERR_COMMON_CODE); + expect(error.message).assertEqual(ERR_COMMON); + } + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 5) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_releaseform_4100 ~ FMS_fuzzTest_releaseform_4800 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = `${tcNumber}`; + const isReleaseCache = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); + console.log(`${promiseName} ${tcNumber} ${describeName} isReleaseCache typeof: ${typeof isReleaseCache}`); + try { + const data = await formHost.releaseForm(formId, isReleaseCache); + console.log(`${promiseName} ${tcNumber} releaseForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`BOOLEAN` === dataType) { + expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE); + expect(error.message).assertEqual(ERR_NOT_EXIST_ID); + } else { + expect(error.code).assertEqual(ERR_COMMON_CODE); + expect(error.message).assertEqual(ERR_COMMON); + } + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/RequestFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/RequestFormFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..de9d3457ed98b3c652c690ae7c77691414a53c34 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/RequestFormFuzz.test.ets @@ -0,0 +1,82 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const requestFormFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_requestform`; + const promiseName = `FMS_fuzzTest_requestform`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_requestform_0100 ~ FMS_fuzzTest_requestform_0800 + * @tc.desc Check whether the requestForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + try { + formHost.requestForm(formId, (error, data) => { + console.log(`${callbackName} ${tcNumber} requestForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_requestform_0900 ~ FMS_fuzzTest_requestform_1600 + * @tc.desc Check whether the requestForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} ${describeName} formId typeof: ${typeof formId}`); + try { + const data = await formHost.requestForm(formId); + console.log(`${promiseName} ${tcNumber} requestForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/SetFormNextRefreshTimeFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/SetFormNextRefreshTimeFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..548ec7b574abce8bd982884f61f2b9f6d1cec53e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/SetFormNextRefreshTimeFuzz.test.ets @@ -0,0 +1,168 @@ +/* + * 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 formProvider from '@ohos.application.formProvider'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const setFormNextRefreshTimeFuzzTest = (describeName, filterParameter) => { + const ERR_COMMON_CODE = 1; + const ERR_COMMON = `internal error`; + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + const ERR_NOT_EXIST_ID_CODE = 9; + const ERR_NOT_EXIST_ID = `the ID of the form to be operated does not exist`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_setnexttime`; + const promiseName = `FMS_fuzzTest_setnexttime`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_setnexttime_0100 ~ FMS_fuzzTest_setnexttime_0800 + * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + const nextTime = 5; + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${callbackName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); + try { + formProvider.setFormNextRefreshTime(formId, nextTime, (error, data) => { + console.log(`${callbackName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_setnexttime_0900 ~ FMS_fuzzTest_setnexttime_1600 + * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + const nextTime = 5; + console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${promiseName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); + try { + const data = await formProvider.setFormNextRefreshTime(formId, nextTime); + console.log(`${promiseName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 2) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_setnexttime_1700 ~ FMS_fuzzTest_setnexttime_2400 + * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = `${tcNumber}`; + const nextTime = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${callbackName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); + try { + formProvider.setFormNextRefreshTime(formId, nextTime, (error, data) => { + console.log(`${callbackName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + if (`NUMBER` === dataType) { + if (ERR_NOT_EXIST_ID_CODE === error.code) { + expect(error.message).assertEqual(ERR_NOT_EXIST_ID); + } else if (ERR_ADD_INVALID_PARAM_CODE === error.code) { + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } else { + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + } else { + expect(error.code).assertEqual(ERR_COMMON_CODE); + expect(error.message).assertEqual(ERR_COMMON); + } + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 3) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_setnexttime_2500 ~ FMS_fuzzTest_setnexttime_3200 + * @tc.desc Check whether the setFormNextRefreshTime interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = `${tcNumber}`; + const nextTime = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${promiseName} ${tcNumber} nextTime typeof: ${typeof nextTime}`); + try { + const data = await formProvider.setFormNextRefreshTime(formId, nextTime); + console.log(`${promiseName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + if (`NUMBER` === dataType) { + if (ERR_NOT_EXIST_ID_CODE === error.code) { + expect(error.message).assertEqual(ERR_NOT_EXIST_ID); + } else if (ERR_ADD_INVALID_PARAM_CODE === error.code) { + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + } else { + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + } else { + expect(error.code).assertEqual(ERR_COMMON_CODE); + expect(error.message).assertEqual(ERR_COMMON); + } + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/UpdateFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/UpdateFormFuzz.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..33faff56300bbb15ec5fcde31f2d82e8da49f5fc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/UpdateFormFuzz.test.ets @@ -0,0 +1,142 @@ +/* + * 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 formProvider from '@ohos.application.formProvider'; +import { describe, expect, it } from 'deccjsunit/index'; +import { DATA_TYPE_LIST, getFuzzData } from './getParam.ets'; + +export const updateFormFuzzTest = (describeName, filterParameter) => { + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_fuzzTest_updateform`; + const promiseName = `FMS_fuzzTest_updateform`; + const length = DATA_TYPE_LIST.length; + + for (let i = 0; i < length; ++i) { + const tcNumber = `0${(i + 1) * 100}`; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_updateform_0100 ~ FMS_fuzzTest_updateform_0800 + * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + let formBindingData = null; + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${callbackName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); + try { + formProvider.updateForm(formId, formBindingData, (error, data) => { + console.log(`${callbackName} ${tcNumber} updateForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + let tcNumber: any = (i + 1 + length) * 100; + tcNumber = tcNumber < 1000 ? `0${tcNumber}` : tcNumber; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_updateform_0900 ~ FMS_fuzzTest_updateform_1600 + * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = getFuzzData(dataType); + let formBindingData = null; + console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${promiseName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); + try { + const data = await formProvider.updateForm(formId, formBindingData); + console.log(`${promiseName} ${tcNumber} updateForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 2) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_updateform_1700 ~ FMS_fuzzTest_updateform_2400 + * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by AsyncCallback) + */ + it(`${callbackName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = `${tcNumber}`; + const formBindingData = getFuzzData(dataType); + console.log(`${callbackName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${callbackName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); + try { + formProvider.updateForm(formId, formBindingData, (error, data) => { + console.log(`${callbackName} ${tcNumber} updateForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(data).assertUndefined(); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + }); + } catch (error) { + console.log(`${callbackName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + console.log(`${callbackName} ${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + } + + for (let i = 0; i < length; ++i) { + const tcNumber: any = (i + 1 + length * 3) * 100; + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_updateform_2500 ~ FMS_fuzzTest_updateform_3200 + * @tc.desc Check whether the updateForm interface can pass the fuzzy test (by Promise) + */ + it(`${promiseName}_${tcNumber}`, filterParameter, async (done) => { + const dataType = DATA_TYPE_LIST[i]; + const formId = `${tcNumber}`; + const formBindingData = getFuzzData(dataType); + console.log(`${promiseName} ${tcNumber} formId typeof: ${typeof formId}`); + console.log(`${promiseName} ${tcNumber} formBindingData typeof: ${typeof formBindingData}`); + try { + const data = await formProvider.updateForm(formId, formBindingData); + console.log(`${promiseName} ${tcNumber} updateForm data: ${JSON.stringify(data)}`); + console.log(`${promiseName} ${tcNumber} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + } + }); + } + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/getParam.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/getParam.ets new file mode 100644 index 0000000000000000000000000000000000000000..29c726720f932d52c1ccedb7d9c1bae3a394c412 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/getParam.ets @@ -0,0 +1,171 @@ +/* + * 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 const REPEAT_COUNT = 2; + +export const DATA_TYPE_LIST = ['ARRAY', 'NUMBER', 'BOOLEAN', 'FUNCTION', 'STRING', 'OBJECT', 'NULL', 'UNDEFINED']; + +var RANDOM_BEGIN_POSITION = 0; +var RANDOM_BEGIN_POSITION_A = 2; +var STRING_RANDOM_LENGTH = 2064; +var BOOLEAN_RANDOM_LENGTH = 2; +var ARRAY_RANDOM_LENGTH = 10; +var ARRAY_RANDOM_TYPE_LENGTH = 3; +var OBJECT_RANDOM_LENGTH = 2; +var FUNCTION_RANDOM_LENGTH = 2; + +//string ascii +var STRING_RANDOM_LENGTH_A = 48; +var STRING_RANDOM_LENGTH_B = 58; +var STRING_RANDOM_LENGTH_C = 65; +var STRING_RANDOM_LENGTH_D = 91; +var STRING_RANDOM_LENGTH_E = 97; +var STRING_RANDOM_LENGTH_F = 122; + +// Return integer random, the range is: [iStart, iEnd) +function getIntegerRandom(iStart, iEnd) { + var decimal = iStart + (iEnd - iStart) * Math.random(); + return Math.floor(decimal); +} + +// return string random, the string length is: [0, 2064) +const stringTest = function () { + // string + var res = ''; + + // string length + var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, STRING_RANDOM_LENGTH); + for (var iAsciiToChar = RANDOM_BEGIN_POSITION; iAsciiToChar < iNumber; iAsciiToChar++) { + var iNumberString = getIntegerRandom(RANDOM_BEGIN_POSITION, RANDOM_BEGIN_POSITION_A); + + switch (iNumberString) { + case 0: + // get ascii [0-9] + iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_A, STRING_RANDOM_LENGTH_B); + break; + case 1: + // get ascii [A-Z] + iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_C, STRING_RANDOM_LENGTH_D); + break; + case 2: + default: + // get ascii [a-z] + iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_E, STRING_RANDOM_LENGTH_F); + break; + } + // from ascii to char + var asciiToChar = String.fromCharCode(iNumber); + res += asciiToChar; + } + console.log('The stringTest of this fuzzTest random:' + res); + return res; +}; + +// return number random, the number length is: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER] +const numberTest = function () { + const res = getIntegerRandom(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER + 1); + console.log('The numberTest of this fuzzTest random:' + res); + return res; +}; + +// return boolean random, the boolean value is: 0->(false), 1->(true) +const booleanTest = function () { + console.log('The booleanTest of this fuzzTest random'); + return Boolean(getIntegerRandom(RANDOM_BEGIN_POSITION, BOOLEAN_RANDOM_LENGTH)); +}; + +// null +const nullTest = function () { + console.log('The nullTest of this fuzzTest random'); + return null; +}; + +// undefined +const undefinedTest = function () { + console.log('The undefinedTest of this fuzzTest random'); + return undefined; +}; + +// return array random, the array value is: string,number,bool +const arrayTest = function () { + var arrValue = []; + + // array length + var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, ARRAY_RANDOM_LENGTH); + for (var iArrNumber = 0; iArrNumber < iNumber; iArrNumber++) { + // string,number,bool + iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, ARRAY_RANDOM_TYPE_LENGTH); + switch (iNumber) { + case 0: + arrValue[iArrNumber] = stringTest(); + break; + case 1: + arrValue[iArrNumber] = numberTest(); + break; + case 2: + arrValue[iArrNumber] = booleanTest(); + break; + default: + arrValue[iArrNumber] = ''; + } + } + console.log('The arrayTest of this fuzzTest random:' + arrValue); + return arrValue; +}; + +// return objectTest random, the objectTest value is: null, not null +const objectTest = function () { + var objectA = {}; + var objectb = { id: 'objectTest' }; + var objectB = Object.create(objectb); + + console.log('The objectTest of this fuzzTest random'); + return getIntegerRandom(RANDOM_BEGIN_POSITION, OBJECT_RANDOM_LENGTH) ? objectA : objectB; +}; + +// return functionTest random, the functionTest value is: null, not null +const functionTest = function () { + var functionA = {}; + var functionB = { id: 'functionTest' }; + + console.log('The functionTest of this fuzzTest random'); + return getIntegerRandom(RANDOM_BEGIN_POSITION, FUNCTION_RANDOM_LENGTH) ? functionA : functionB; +}; + +// return fuzz data +const getFuzzData = (datatype: string) => { + switch (datatype) { + case 'ARRAY': + return arrayTest(); + case 'BOOLEAN': + return booleanTest(); + case 'FUNCTION': + return functionTest(); + case 'NULL': + return nullTest(); + case 'NUMBER': + return numberTest(); + case 'OBJECT': + return objectTest(); + case 'STRING': + return stringTest(); + case 'UNDEFINED': + return undefinedTest(); + default: + return stringTest(); + } +}; + +export { getFuzzData, stringTest, numberTest, booleanTest, nullTest, undefinedTest, objectTest, arrayTest, functionTest }; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..85549b028a9ba9a39d71e1128b24b0deb13a5b20 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormsOneAndOneTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormsOneAndOneTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d3a25ebfc5776593d89c3ea1b2f2b9c0cbf3b863 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formsoneandonetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormsOneAndOneTest.hap", + "FormSystemProviderB.hap", + "FormSystemProviderC.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ffdbd0ae1a7de07bcdcd1141bcd95cb64a2b6e98 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json @@ -0,0 +1,114 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsoneandonetest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsoneandonetest", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d571123825ec0f228a7d230e9e84aa3ab337a29f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a39d5ea046c98a45fe715f66a7ba53c816e634d4 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; +import testsuite from '../test/List.test.ets'; + +@Entry +@Component +struct Index { + private componentName: string = `FormsOneAndOneTest`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`${this.componentName}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..07139019e97f33bcf6b0198b7212806a5f8d393d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -0,0 +1,146 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getAllFormsInfoTest = (describeName, filterParameter) => { + const ERR_OK_CODE = 0; + const ERR_OK = `success`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0500 callback`; + const promiseName = `FMS_getFormsInfo_0500 promise`; + + const expectDataB = { + bundleName: 'com.ohos.st.formsystemproviderb', + moduleName: 'form_module_b', + abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', + name: 'FormB_Js001', + description: 'form_description_FormB_Js001', + descriptionId: 20, + type: 1, + jsComponentName: 'card_b', + colorMode: -1, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilityb', + updateDuration: 3, + scheduledUpdateTime: '10:30', + defaultDimension: 2, + supportDimensions: [1, 2], + metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, + }; + + const expectDataC = { + bundleName: 'com.ohos.st.formsystemproviderc', + moduleName: 'form_module_c', + abilityName: 'com.ohos.st.formsystemproviderc.MainAbility', + name: 'FormC_Js001', + description: 'form_description_FormC_Js001', + descriptionId: 30, + type: 1, + jsComponentName: 'card_c', + colorMode: 1, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilityc', + updateDuration: 4, + scheduledUpdateTime: '15:30', + defaultDimension: 3, + supportDimensions: [3, 4], + metaData: { customizeData: [{ name: 'originWidgetNameC', value: 'valueC' }] }, + }; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0500 + * @tc.desc: Query all form configuration information (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getAllFormsInfo((error, data) => { + console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + console.log(`${callbackName} forms amount: ${data.length}`); + + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${callbackName} formB amount: ${dataB.length}`); + const dataC = data.filter((form) => { + return `com.ohos.st.formsystemproviderc` === form.bundleName; + }); + console.log(`${callbackName} form dataC: ${JSON.stringify(dataC)}`); + console.log(`${callbackName} formC amount: ${dataC.length}`); + + expect(dataB.length).assertEqual(1); + expect(dataC.length).assertEqual(1); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0500 + * @tc.desc: Query all form configuration information (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getAllFormsInfo(); + console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} forms amount: ${data.length}`); + + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${promiseName} formB amount: ${dataB.length}`); + const dataC = data.filter((form) => { + return `com.ohos.st.formsystemproviderc` === form.bundleName; + }); + console.log(`${promiseName} form dataC: ${JSON.stringify(dataC)}`); + console.log(`${promiseName} formC amount: ${dataC.length}`); + + expect(dataB.length).assertEqual(1); + expect(dataC.length).assertEqual(1); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f44d4bc068cb149fb7c2a113a083bc1a6ec6ae3d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets @@ -0,0 +1,521 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getFormsInfoTest = (describeName, filterParameter) => { + const ERR_OK_CODE = 0; + const ERR_OK = `success`; + const ERR_GET_BUNDLE_FAILED_CODE = 5; + const ERR_GET_BUNDLE_FAILED = `failed to obtain the bundle information`; + const ERR_ADD_INVALID_PARAM_CODE = 7; + const ERR_ADD_INVALID_PARAM = `invalid input parameter during form operation`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0900 callback`; + const promiseName = `FMS_getFormsInfo_0900 promise`; + const bundleName = ``; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0900 + * @tc.desc: Query specific form configuration information by empty bundle name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0900 + * @tc.desc: Query specific form configuration information by empty bundle name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1000 callback`; + const promiseName = `FMS_getFormsInfo_1000 promise`; + const bundleName = `wrong.bundle.name`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1000 + * @tc.desc: Query specific form configuration information by wrong bundle name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1000 + * @tc.desc: Query specific form configuration information by wrong bundle name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1100 callback`; + const promiseName = `FMS_getFormsInfo_1100 promise`; + const bundleName = `com.ohos.st.formsystemproviderb`; + + const expectDataB = { + bundleName: 'com.ohos.st.formsystemproviderb', + moduleName: 'form_module_b', + abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', + name: 'FormB_Js001', + description: 'form_description_FormB_Js001', + descriptionId: 20, + type: 1, + jsComponentName: 'card_b', + colorMode: -1, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilityb', + updateDuration: 3, + scheduledUpdateTime: '10:30', + defaultDimension: 2, + supportDimensions: [1, 2], + metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, + }; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1100 + * @tc.desc: Query specific form configuration information by correct bundle name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + console.log(`${callbackName} forms amount: ${data.length}`); + + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${callbackName} formB amount: ${dataB.length}`); + + expect(data.length).assertEqual(1); + expect(dataB.length).assertEqual(1); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1100 + * @tc.desc: Query specific form configuration information by correct bundle name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} forms amount: ${data.length}`); + + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${promiseName} formB amount: ${dataB.length}`); + + expect(data.length).assertEqual(1); + expect(dataB.length).assertEqual(1); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1400 callback`; + const promiseName = `FMS_getFormsInfo_1400 promise`; + const bundleName = ``; + const moduleName = `form_module_c`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1400 + * @tc.desc: Query specific form configuration information by empty bundle name and correct module name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1400 + * @tc.desc: Query specific form configuration information by empty bundle name and correct module name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1500 callback`; + const promiseName = `FMS_getFormsInfo_1500 promise`; + const bundleName = `wrong.bundle.name`; + const moduleName = `form_module_c`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1500 + * @tc.desc: Query specific form configuration information by wrong bundle name and correct module name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1500 + * @tc.desc: Query specific form configuration information by wrong bundle name and correct module name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); + expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1600 callback`; + const promiseName = `FMS_getFormsInfo_1600 promise`; + const bundleName = `com.ohos.st.formsystemproviderc`; + const moduleName = ``; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1600 + * @tc.desc: Query specific form configuration information by correct bundle name and empty module name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1600 + * @tc.desc: Query specific form configuration information by correct bundle name and empty module name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); + expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1700 callback`; + const promiseName = `FMS_getFormsInfo_1700 promise`; + const bundleName = `com.ohos.st.formsystemproviderc`; + const moduleName = `wrong.module.name`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1700 + * @tc.desc: Query specific form configuration information by correct bundle name and wrong module name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(JSON.stringify(data)).assertEqual(`[]`); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1700 + * @tc.desc: Query specific form configuration information by correct bundle name and wrong module name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + expect(JSON.stringify(data)).assertEqual(`[]`); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1800 callback`; + const promiseName = `FMS_getFormsInfo_1800 promise`; + const bundleName = `com.ohos.st.formsystemproviderc`; + const moduleName = `form_module_c`; + + const expectDataC = { + bundleName: 'com.ohos.st.formsystemproviderc', + moduleName: 'form_module_c', + abilityName: 'com.ohos.st.formsystemproviderc.MainAbility', + name: 'FormC_Js001', + description: 'form_description_FormC_Js001', + descriptionId: 30, + type: 1, + jsComponentName: 'card_c', + colorMode: 1, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilityc', + updateDuration: 4, + scheduledUpdateTime: '15:30', + defaultDimension: 3, + supportDimensions: [3, 4], + metaData: { customizeData: [{ name: 'originWidgetNameC', value: 'valueC' }] }, + }; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1800 + * @tc.desc: Query specific form configuration information by correct bundle name and correct module name (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + console.log(`${callbackName} forms amount: ${data.length}`); + + const dataC = data.filter((form) => { + return `com.ohos.st.formsystemproviderc` === form.bundleName; + }); + console.log(`${callbackName} form dataC: ${JSON.stringify(dataC)}`); + console.log(`${callbackName} formC amount: ${dataC.length}`); + + expect(data.length).assertEqual(1); + expect(dataC.length).assertEqual(1); + expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1800 + * @tc.desc: Query specific form configuration information by correct bundle name and correct module name (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} forms amount: ${data.length}`); + + const dataC = data.filter((form) => { + return `com.ohos.st.formsystemproviderc` === form.bundleName; + }); + console.log(`${promiseName} form dataC: ${JSON.stringify(dataC)}`); + console.log(`${promiseName} formC amount: ${dataC.length}`); + + expect(data.length).assertEqual(1); + expect(dataC.length).assertEqual(1); + expect(JSON.stringify(dataC[0])).assertEqual(JSON.stringify(expectDataC)); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..60eb766854deb0998cf820ea670bbbb39d0e7769 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,30 @@ +/* + * 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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; +import { getFormsInfoTest } from './GetFormsInfo.test.ets'; + +export default function testsuite() { + // FMS_getFormsInfo_0500 + getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); + // FMS_getFormsInfo_0900 + // FMS_getFormsInfo_1000 + // FMS_getFormsInfo_1100 + // FMS_getFormsInfo_1400 + // FMS_getFormsInfo_1500 + // FMS_getFormsInfo_1600 + // FMS_getFormsInfo_1700 fail + // FMS_getFormsInfo_1800 + getFormsInfoTest(`GetFormsInfoTest`, 0); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7287717f786c3518c0930bc76963bfeaf42357a2 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormsOneAndTwoTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormsOneAndTwoTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..ca9ca39beb59c1f49508e211de8d64491860a498 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formsoneandtwotest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormsOneAndTwoTest.hap", + "FormSystemProviderA.hap", + "FormSystemProviderB.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c554bf7f0b374d89d4b1e180cd8b909f6c5737c2 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json @@ -0,0 +1,114 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsoneandtwotest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsoneandtwotest", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d571123825ec0f228a7d230e9e84aa3ab337a29f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..fcbc42d152ff2db108588036a875287feb8f8d12 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; +import testsuite from '../test/List.test.ets'; + +@Entry +@Component +struct Index { + private componentName: string = `FormsOneAndTwoTest`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`${this.componentName}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f43e9af5e74e0f3d8d6727f6240b6407e5344fab --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -0,0 +1,169 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getAllFormsInfoTest = (describeName, filterParameter) => { + const ERR_OK_CODE = 0; + const ERR_OK = `success`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0600 callback`; + const promiseName = `FMS_getFormsInfo_0600 promise`; + + const expectDataA01 = { + bundleName: 'com.ohos.st.formsystemprovidera', + moduleName: 'form_module_a', + abilityName: 'com.ohos.st.formsystemprovidera.MainAbility', + name: 'FormA_Js001', + description: 'form_description_FormA_Js001', + descriptionId: 0, + type: 1, + jsComponentName: 'card_a01', + colorMode: 0, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilitya01', + updateDuration: 1, + scheduledUpdateTime: '5:30', + defaultDimension: 1, + supportDimensions: [1, 3], + metaData: { customizeData: [{ name: 'originWidgetNameA01', value: 'valueA01' }] }, + }; + + const expectDataA02 = { + bundleName: 'com.ohos.st.formsystemprovidera', + moduleName: 'form_module_a', + abilityName: 'com.ohos.st.formsystemprovidera.MainAbility', + name: 'FormA_Js002', + description: 'form_description_FormA_Js002', + descriptionId: 10, + type: 1, + jsComponentName: 'card_a02', + colorMode: 1, + isDefault: 0, + updateEnabled: 0, + formVisibleNotify: 0, + formConfigAbility: 'abilitya02', + updateDuration: 2, + scheduledUpdateTime: '20:30', + defaultDimension: 4, + supportDimensions: [1, 2, 3, 4], + metaData: { customizeData: [{ name: 'originWidgetNameA02', value: 'valueA02' }] }, + }; + + const expectDataB = { + bundleName: 'com.ohos.st.formsystemproviderb', + moduleName: 'form_module_b', + abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', + name: 'FormB_Js001', + description: 'form_description_FormB_Js001', + descriptionId: 20, + type: 1, + jsComponentName: 'card_b', + colorMode: -1, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilityb', + updateDuration: 3, + scheduledUpdateTime: '10:30', + defaultDimension: 2, + supportDimensions: [1, 2], + metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, + }; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0600 + * @tc.desc: Query all form configuration information (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getAllFormsInfo((error, data) => { + console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + console.log(`${callbackName} forms amount: ${data.length}`); + + const dataA = data.filter((form) => { + return `com.ohos.st.formsystemprovidera` === form.bundleName; + }); + console.log(`${callbackName} form dataA: ${JSON.stringify(dataA)}`); + console.log(`${callbackName} formA amount: ${dataA.length}`); + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${callbackName} formB amount: ${dataB.length}`); + + expect(dataA.length).assertEqual(2); + expect(dataB.length).assertEqual(1); + expect(JSON.stringify(dataA[0])).assertEqual(JSON.stringify(expectDataA01)); + expect(JSON.stringify(dataA[1])).assertEqual(JSON.stringify(expectDataA02)); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0600 + * @tc.desc: Query all form configuration information (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getAllFormsInfo(); + console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} forms amount: ${data.length}`); + + const dataA = data.filter((form) => { + return `com.ohos.st.formsystemprovidera` === form.bundleName; + }); + console.log(`${promiseName} form dataA: ${JSON.stringify(dataA)}`); + console.log(`${promiseName} formA amount: ${dataA.length}`); + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${promiseName} formB amount: ${dataB.length}`); + + expect(dataA.length).assertEqual(2); + expect(dataB.length).assertEqual(1); + expect(JSON.stringify(dataA[0])).assertEqual(JSON.stringify(expectDataA01)); + expect(JSON.stringify(dataA[1])).assertEqual(JSON.stringify(expectDataA02)); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..93f75c7f1771fffda8f4ec9809b493db7cb54f1a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; + +export default function testsuite() { + // FMS_getFormsInfo_0600 + getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e42e7fe0f02bc0f630b243529aa7029e4bab40e4 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormsOneAndZeroTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormsOneAndZeroTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..79d26f01ee745d7997b6040fef388d7acfeb53d8 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formsoneandzerotest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormsOneAndZeroTest.hap", + "FormSystemProviderB.hap", + "FormSystemProviderD.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e7891fe8147c649b0117d2fd306f27d22b0a9cc1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json @@ -0,0 +1,114 @@ +{ + "app": { + "bundleName": "com.ohos.st.formsoneandzerotest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formsoneandzerotest", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d571123825ec0f228a7d230e9e84aa3ab337a29f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a89132a4e62eabe2bfb7bb9868800240227282e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; +import testsuite from '../test/List.test.ets'; + +@Entry +@Component +struct Index { + private componentName: string = `FormsOneAndZeroTest`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`${this.componentName}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f8e8d3779fb1fc4af101b0b80fbe260d6be72ae --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -0,0 +1,125 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getAllFormsInfoTest = (describeName, filterParameter) => { + const ERR_OK_CODE = 0; + const ERR_OK = `success`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0400 callback`; + const promiseName = `FMS_getFormsInfo_0400 promise`; + + const expectDataB = { + bundleName: 'com.ohos.st.formsystemproviderb', + moduleName: 'form_module_b', + abilityName: 'com.ohos.st.formsystemproviderb.MainAbility', + name: 'FormB_Js001', + description: 'form_description_FormB_Js001', + descriptionId: 20, + type: 1, + jsComponentName: 'card_b', + colorMode: -1, + isDefault: 1, + updateEnabled: 1, + formVisibleNotify: 1, + formConfigAbility: 'abilityb', + updateDuration: 3, + scheduledUpdateTime: '10:30', + defaultDimension: 2, + supportDimensions: [1, 2], + metaData: { customizeData: [{ name: 'originWidgetNameB', value: 'valueB' }] }, + }; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0400 + * @tc.desc: Query all form configuration information (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getAllFormsInfo((error, data) => { + console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + console.log(`${callbackName} forms amount: ${data.length}`); + + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${callbackName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${callbackName} formB amount: ${dataB.length}`); + const dataD = data.filter((form) => { + return `com.ohos.st.formsystemproviderd` === form.bundleName; + }); + console.log(`${callbackName} form dataD: ${JSON.stringify(dataD)}`); + console.log(`${callbackName} formD amount: ${dataD.length}`); + + expect(dataB.length).assertEqual(1); + expect(dataD.length).assertEqual(0); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + expect(JSON.stringify(dataD)).assertEqual(`[]`); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0400 + * @tc.desc: Query all form configuration information (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getAllFormsInfo(); + console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} forms amount: ${data.length}`); + + const dataB = data.filter((form) => { + return `com.ohos.st.formsystemproviderb` === form.bundleName; + }); + console.log(`${promiseName} form dataB: ${JSON.stringify(dataB)}`); + console.log(`${promiseName} formB amount: ${dataB.length}`); + const dataD = data.filter((form) => { + return `com.ohos.st.formsystemproviderd` === form.bundleName; + }); + console.log(`${promiseName} form dataD: ${JSON.stringify(dataD)}`); + console.log(`${promiseName} formD amount: ${dataD.length}`); + + expect(dataB.length).assertEqual(1); + expect(dataD.length).assertEqual(0); + expect(JSON.stringify(dataB[0])).assertEqual(JSON.stringify(expectDataB)); + expect(JSON.stringify(dataD)).assertEqual(`[]`); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..eba498a1ea8952b02ec95073f141acca7a3f615b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; + +export default function testsuite() { + // FMS_getFormsInfo_0400 + getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..685e2c58c71e947e368c1a2ddea55ff50e045683 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormsWithoutPermTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormsWithoutPermTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..608989c1e379a524a9fbf33b519e354700eaa3ff --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formswithoutpermtest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormsWithoutPermTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0783c577fa31b903c0430c50b27cfa418c363980 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json @@ -0,0 +1,110 @@ +{ + "app": { + "bundleName": "com.ohos.st.formswithoutpermtest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formswithoutpermtest", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d571123825ec0f228a7d230e9e84aa3ab337a29f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..dcdf0676df5c11b2bc1854fe2c0ff1569847cc27 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; +import testsuite from '../test/List.test.ets'; + +@Entry +@Component +struct Index { + private componentName: string = `FormsWithoutPermTest`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`${this.componentName}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..665295b6e660b6cec88eaafda932f7fe0bb57bd3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -0,0 +1,72 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getAllFormsInfoTest = (describeName, filterParameter) => { + const ERR_OK_CODE = 0; + const ERR_OK = `success`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0200 callback`; + const promiseName = `FMS_getFormsInfo_0200 promise`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0200 + * @tc.desc: Query all form configuration information without permission (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getAllFormsInfo((error, data) => { + console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(JSON.stringify(data)).assertEqual(`[]`); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0200 + * @tc.desc: Query all form configuration information without permission (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getAllFormsInfo(); + console.log(`${promiseName} getAllFormsInfo data: ${JSON.stringify(data)}`); + expect(JSON.stringify(data)).assertEqual(`[]`); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9430b2008746ef922513aaaff9d4c76ec69ab72d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets @@ -0,0 +1,125 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getFormsInfoTest = (describeName, filterParameter) => { + const ERR_PERMISSION_DENY_CODE = 2; + const ERR_PERMISSION_DENY = `does not have permission to use forms`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0800 callback`; + const promiseName = `FMS_getFormsInfo_0800 promise`; + const bundleName = `1`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0800 + * @tc.desc: Query specific form configuration information by bundle name without permission (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); + expect(error.message).assertEqual(ERR_PERMISSION_DENY); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0800 + * @tc.desc: Query specific form configuration information by bundle name without permission (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); + expect(error.message).assertEqual(ERR_PERMISSION_DENY); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_1300 callback`; + const promiseName = `FMS_getFormsInfo_1300 promise`; + const bundleName = `2`; + const moduleName = `a`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_1300 + * @tc.desc: Query specific form configuration information by bundle name and module name without permission (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getFormsInfo(bundleName, moduleName, (error, data) => { + console.log(`${callbackName} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); + expect(error.message).assertEqual(ERR_PERMISSION_DENY); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_1300 + * @tc.desc: Query specific form configuration information by bundle name and module name without permission (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getFormsInfo(bundleName, moduleName); + console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + expect(error.code).assertEqual(ERR_PERMISSION_DENY_CODE); + expect(error.message).assertEqual(ERR_PERMISSION_DENY); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb9b98dc7af78d36fa079a29ed2fce0c4ef8dafc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -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 { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; +import { getFormsInfoTest } from './GetFormsInfo.test.ets'; + +export default function testsuite() { + // FMS_getFormsInfo_0200 + getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); + // FMS_getFormsInfo_0800 + // FMS_getFormsInfo_1300 + getFormsInfoTest(`GetFormsInfoTest`, 0); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..600e697f9eec3a0bb18e3aa1eb22404953149ce1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormsZeroTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormsZeroTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..1e84c156fb08f6fa11585e900bc6f50fa65c7336 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formszerotest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormsZeroTest.hap", + "FormSystemProviderD.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..041bbb3370fff840ad9017f2f974de3333136915 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json @@ -0,0 +1,114 @@ +{ + "app": { + "bundleName": "com.ohos.st.formszerotest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formszerotest", + "name": ".FormSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..d571123825ec0f228a7d230e9e84aa3ab337a29f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca551d272f732e4b999d1517c078d3717be565a4 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index'; +import testsuite from '../test/List.test.ets'; + +@Entry +@Component +struct Index { + private componentName: string = `FormsZeroTest`; + + aboutToAppear() { + console.info(`${this.componentName} start run testcase!!!!`); + + featureAbility.getWant() + .then((want: any) => { + console.info(`${this.componentName} Operation successful. Data: ${JSON.stringify(want)}`); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error(`${this.componentName} Operation failed. Cause: ${JSON.stringify(error)}`); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text(`${this.componentName}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb3abde74d93513be04c148c44245d324186cab5 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -0,0 +1,84 @@ +/* + * 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 formHost from '@ohos.application.formHost'; +import { describe, expect, it } from 'deccjsunit/index'; + +export const getAllFormsInfoTest = (describeName, filterParameter) => { + const ERR_OK_CODE = 0; + const ERR_OK = `success`; + + describe(`${describeName}`, () => { + const callbackName = `FMS_getFormsInfo_0300 callback`; + const promiseName = `FMS_getFormsInfo_0300 promise`; + + /** + * @tc.name: getFormsInfo + * @tc.number: FMS_getFormsInfo_0300 + * @tc.desc: Query all form configuration information without permission (by AsyncCallback) + */ + it(`${callbackName}`, filterParameter, async (done) => { + console.log(`==========${callbackName} ${describeName} start==========`); + + try { + formHost.getAllFormsInfo((error, data) => { + console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); + + const dataD = data.filter((form) => { + return `com.ohos.st.formsystemproviderd` === form.bundleName; + }); + console.log(`${callbackName} form dataD: ${JSON.stringify(dataD)}`); + console.log(`${callbackName} formD amount: ${dataD.length}`); + expect(dataD.length).assertEqual(0); + expect(JSON.stringify(dataD)).assertEqual(`[]`); + expect(error.code).assertEqual(ERR_OK_CODE); + expect(error.message).assertEqual(ERR_OK); + done(); + console.log(`==========${callbackName} ${describeName} end==========`); + }); + } catch (error) { + console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); + console.log(`${callbackName} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.name getFormsInfo + * @tc.number FMS_getFormsInfo_0300 + * @tc.desc: Query all form configuration information without permission (by Promise) + */ + it(`${promiseName}`, filterParameter, async (done) => { + console.log(`==========${promiseName} ${describeName} start==========`); + + try { + const data = await formHost.getAllFormsInfo(); + const dataD = data.filter((form) => { + return `com.ohos.st.formsystemproviderd` === form.bundleName; + }); + console.log(`${callbackName} form dataD: ${JSON.stringify(dataD)}`); + console.log(`${callbackName} formD amount: ${dataD.length}`); + expect(dataD.length).assertEqual(0); + expect(JSON.stringify(dataD)).assertEqual(`[]`); + done(); + console.log(`==========${promiseName} ${describeName} end==========`); + } catch (error) { + console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); + console.log(`${promiseName} should not reach here`); + expect().assertFail(); + } + }); + }); +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a870ab79215bdb534d88ca7b7ca6110d1116677 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { getAllFormsInfoTest } from './GetAllFormsInfo.test.ets'; + +export default function testsuite() { + // FMS_getFormsInfo_0300 + getAllFormsInfoTest(`GetAllFormsInfoTest`, 0); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d70bb93c24e829e90ef754507265376003f02f94 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormHostDeathRecipientTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormHostDeathRecipientTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c9fc4338625f49f9c77daa0c8d709ec9c4bb4986 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/Test.json @@ -0,0 +1,21 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "120000", + "package": "com.ohos.st.formhostdeathrecipienttest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormHostDeathRecipientTest.hap", + "FormSystemHostK.hap", + "FormSystemHostL.hap", + "FormSupplyAppF.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/app.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/app.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d90a8cc5694df48b5b3bd5550a38494acecfef76 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 60000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Host Death Recipient Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..096424303a25fcba5d8072b4f8cc63b594c26124 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets @@ -0,0 +1,428 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the `License`); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an `AS IS` BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import commonEvent from '@ohos.commonEvent'; +import { beforeEach, describe, expect, it } from 'deccjsunit/index'; + +const onAcquiredEvent = { + events: [`FMS_FormOnAcquired_commonEvent`], +}; +const onSupplyEvent = { + events: [`FMS_FormSupply_commonEvent`], +}; +const onRequestEvent = { + events: [`FMS_FormOnRequest_commonEvent`], +}; +const formOnTerminateEvent = `FMS_FormTerminate_commonEvent`; + +let tcNumber; +let hostCounter; +let providerCounter; +let onAcquiredEventSubscriber; +let onSupplyEventSubscriber; +let onRequestEventSubscriber; + +export default function test() { + describe(`FmsHostDeathRecipientTest`, () => { + + beforeEach(async () => { + tcNumber = `FmsHostDeathRecipientTest`; + hostCounter = 0; + providerCounter = 0; + onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent); + onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); + onRequestEventSubscriber = await commonEvent.createSubscriber(onRequestEvent); + }); + + /** + * @tc.number: FMS_hostDeathRecipient_0100 + * @tc.name: Reset host ability. + * @tc.desc: The provider's onDestroy event will be triggered. + */ + it(`FMS_hostDeathRecipient_0100`, 0, async (done) => { + tcNumber = `FMS_hostDeathRecipient_0100`; + let tempFormId; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const hostFormId = data.data; + console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); + + if (data.parameters?.cast) { + tempFormId = hostFormId; + } + if (++hostCounter == 2) { + // onAcquired * 2 + commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); + // terminate host + commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); + console.info(`${tcNumber} onAcquiredCallBack end`); + } + }); + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const supplyFormId = getSupplyFormId(data); + console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); + + if (`onDestroy` == kind) { + expect(tempFormId).assertEqual(supplyFormId); + commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); + + await sleep(1000); + done(); + } + }); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + isCreate: true, + createTempAndNormal: true, + subscribeTerminate: true + }); + }); + + /** + * @tc.number: FMS_hostDeathRecipient_0200 + * @tc.name: Reset host ability and requestForm. + * @tc.desc: The provider's onDestroy event will be triggered. + */ + it(`FMS_hostDeathRecipient_0200`, 0, async (done) => { + tcNumber = `FMS_hostDeathRecipient_0200`; + let normalFormId; + let tempFormId; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const hostFormId = data.data; + console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); + + if (data.parameters?.cast) { + tempFormId = hostFormId; + } else { + normalFormId = hostFormId; + } + if (++hostCounter == 2) { + // onAcquired * 2 + commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); + // terminate host + commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); + await sleep(2000); + // reset host + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + formId: normalFormId, + isCreate: true, + requestForm: true, + requestId: normalFormId, + subscribeTerminate: true + }); + console.info(`${tcNumber} onAcquiredCallBack end`); + } + }); + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const supplyFormId = getSupplyFormId(data); + console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); + + if (`onDestroy` == kind) { + expect(tempFormId).assertEqual(supplyFormId); + } else if (`onUpdate` == kind) { + expect(normalFormId).assertEqual(supplyFormId); + } + if (++providerCounter == 4) { + // onCreate * 2 onDestroy * 1 onUpdate * 1 + commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); + console.info(`${tcNumber} onSupplyCallBack end`); + await sleep(1000); + done(); + } + }); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + isCreate: true, + createTempAndNormal: true, + subscribeTerminate: true + }); + }); + + /** + * @tc.number: FMS_hostDeathRecipient_0300 + * @tc.name: Reset host ability. + * @tc.desc: The provider's onDestroy event will be triggered but requestForm will be failed. + */ + it(`FMS_hostDeathRecipient_0300`, 0, async (done) => { + tcNumber = `FMS_hostDeathRecipient_0300`; + let tempFormId; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const hostFormId = data.data; + console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); + + if (data.parameters) { + tempFormId = hostFormId; + commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); + // terminate host + commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); + console.info(`${tcNumber} onAcquiredCallBack end`); + } + }); + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const supplyFormId = getSupplyFormId(data); + console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); + + if (`onDestroy` == kind) { + expect(tempFormId).assertEqual(supplyFormId); + } + if (++providerCounter == 2) { + // onCreate * 1 + // onDestroy * 1 + commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); + + await sleep(1000); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + requestForm: true, + requestId: tempFormId + }); + console.info(`${tcNumber} onSupplyCallBack end`); + } + }); + commonEvent.subscribe(onRequestEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onRequestCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + commonEvent.unsubscribe(onRequestEventSubscriber, unsubscribeOnRequestCallback); + + const error = data.parameters.error; + expect(error.code).assertEqual(9); + expect(error.message).assertEqual(`the ID of the form to be operated does not exist`); + console.info(`${tcNumber} onRequestCallBack end`); + + await sleep(1000); + done(); + }); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + isCreate: true, + temporary: true, + subscribeTerminate: true + }); + }); + + /** + * @tc.number: FMS_hostDeathRecipient_0500 + * @tc.name: Reset host ability and requestForm. + * @tc.desc: The provider's onUpdate event will be triggered. + */ + it(`FMS_hostDeathRecipient_0500`, 0, async (done) => { + tcNumber = `FMS_hostDeathRecipient_0500`; + let hostFormId; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + hostFormId = data.data; + console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); + + commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); + // start abilityb + await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, { + formId: hostFormId, + isCreate: true + }); + // terminate host + commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); + await sleep(2000); + // reset host a + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + formId: hostFormId, + requestForm: true, + requestId: hostFormId, + }); + console.info(`${tcNumber} onAcquiredCallBack end`); + }); + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const supplyFormId = getSupplyFormId(data); + console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); + + if (`onUpdate` == kind) { + expect(hostFormId).assertEqual(supplyFormId); + } + if (++providerCounter == 2) { + // onCreate * 1 host A + // onUpdate * 1 + commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); + console.info(`${tcNumber} onSupplyCallBack end`); + + await sleep(1000); + done(); + } + }); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + isCreate: true, + subscribeTerminate: true + }); + }); + + /** + * @tc.number: FMS_hostDeathRecipient_0600 + * @tc.name: Reset host ability and requestForm. + * @tc.desc: The provider's onUpdate event will be triggered. + */ + it(`FMS_hostDeathRecipient_0600`, 0, async (done) => { + tcNumber = `FMS_hostDeathRecipient_0600`; + let hostFormId; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + hostFormId = data.data; + console.info(`${tcNumber} onAcquiredCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallBack formId: ${hostFormId}`); + + commonEvent.unsubscribe(onAcquiredEventSubscriber, unsubscribeOnAcquiredCallback); + // start abilityb + await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, { + formId: hostFormId, + isCreate: true + }); + // terminate host + commonEvent.publish(formOnTerminateEvent, publishOnTerminateCallback); + await sleep(2000); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + formId: hostFormId, + isCreate: true, + requestForm: true, + requestId: hostFormId, + subscribeTerminate: true + }); + await sleep(2000); + await startAbility(`com.ohos.st.formsystemhostl`, `com.ohos.st.formsystemhostl.MainAbility`, { + formId: hostFormId, + requestForm: true, + requestId: hostFormId, + }); + console.info(`${tcNumber} onAcquiredCallBack end`); + }); + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const supplyFormId = getSupplyFormId(data); + console.info(`${tcNumber} onSupplyCallBack data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onSupplyCallBack formId: ${supplyFormId} kind: ${kind}`); + + if (`onUpdate` == kind) { + expect(hostFormId).assertEqual(supplyFormId); + } + if (++providerCounter == 3) { + // onCreate * 1 host A + // onUpdate * 2 + commonEvent.unsubscribe(onSupplyEventSubscriber, unsubscribeOnSupplyCallback); + console.info(`${tcNumber} onSupplyCallBack end`); + + await sleep(1000); + done(); + } + }); + await startAbility(`com.ohos.st.formsystemhostk`, `com.ohos.st.formsystemhostk.MainAbility`, { + isCreate: true, + subscribeTerminate: true + }); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const getSupplyFormId = (data) => { + switch (data.parameters.kind) { + case `onCreate`: + return JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`]; + case `onVisibilityChange`: + return Object.keys(JSON.parse(data.parameters.parameters))[0] + default: + return data.parameters.parameters; + } +} + +const unsubscribeOnAcquiredCallback = () => { + console.info(`${tcNumber} unsubscribeOnAcquired callback`); +} +const unsubscribeOnSupplyCallback = () => { + console.info(`${tcNumber} unsubscribeOnSupply callback`); +} +const unsubscribeOnRequestCallback = () => { + console.info(`${tcNumber} unsubscribeOnRequest callback`); +} +const publishOnTerminateCallback = () => { + console.info(`${tcNumber} publishOnTerminate callback`); +} + +interface Parameters { + formId?: String, + name?: String, + bundle?: String, + ability?: String, + moduleName?: String, + temporary?: Boolean, + isCreate?: Boolean, + createTempAndNormal?: Boolean, + subscribeTerminate?: Boolean, + tempParam?: Object, + [key: string]: any +} + +const startAbility = async ( + bundleName, + abilityName, + parameters: Parameters) => { + + parameters = Object.assign({ + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry`, + temporary: false, + isCreate: false, + createTempAndNormal: false, + subscribeTerminate: false, + }, parameters); + if (parameters.createTempAndNormal) { + parameters.tempParam = { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry` + }; + } + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: bundleName, + abilityName: abilityName, + parameters: parameters + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} featureAbility.startAbility error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } +}; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..94149104583a2ee30232b96783bbc03fa2fc13a7 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsHostDeathRecipient.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..585c089735ff2cd75fef593fd215f882f368ed8e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormPerformanceTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormPerformanceTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5e0ae08e4331e977092d65e48243011363e4e07d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formperformancetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormPerformanceTest.hap", + "FormSystemHostK.hap", + "FormSupplyAppG.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb7e7d915b15ace2949b7e52af0a1a560843ee72 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f235c8023f5fad5ea7e4e4d3f2a3f9a0b20aec65 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 20000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Performance Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c740db61a8bfb6763f72b992fbc7a35bc4eb385 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets @@ -0,0 +1,940 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the `License`); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an `AS IS` BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import formHost from '@ohos.application.formHost'; +import commonEvent from '@ohos.commonEvent'; +import systemTime from '@ohos.systemTime'; +import { beforeEach, describe, expect, it } from 'deccjsunit/index'; + +const onAcquiredEvent = { + events: [`FMS_FormOnAcquired_commonEvent`], +}; +const onSupplyEvent = { + events: [`FMS_FormSupply_commonEvent`], +}; +const formOnDeleteEvent = `FMS_FormDelete_commonEvent`; + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`${tcNumber} unsubscribeOnAcquired callback`); +} +const unsubscribeOnSupplyCallback = (tcNumber) => { + console.info(`${tcNumber} unsubscribeOnSupply callback`); +} +const publishOnDeleteCallback = (tcNumber, done) => { + console.info(`${tcNumber} publishOnDelete callback`); + done(); +} + +let onAcquiredEventSubscriber; +let onSupplyEventSubscriber; + +export default function test() { + describe(`FmsPerformanceTest`, () => { + + beforeEach(async () => { + onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent); + onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); + }); + + /** + * @tc.number: FMS_performanceTest_0100 + * @tc.name: Performance test. + * @tc.desc: Create form. + */ + it(`FMS_performanceTest_0100`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0100`; + const timeout = 1000; + let endflag = 0; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + const hostEndTime = data.parameters.time; + const hostTime = hostEndTime - startTime + console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onCreate` == kind) { + const providerEndTime = data.parameters.time; + const providerTime = providerEndTime - startTime; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onCreate end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + } + }); + + const startTime = await systemTime.getCurrentTime(); + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0200 + * @tc.name: Performance test. + * @tc.desc: Delete form. + */ + it(`FMS_performanceTest_0200`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0200`; + const timeout = 1000; + let startTime = -1; + let endflag = 0; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`deleteForm` == data.parameters.kind) { + startTime = data.parameters.startTime; + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback_deleteForm end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + } + }); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onDestroy` == kind) { + setTimeout(() => { + const providerEndTime = data.parameters.time; + const providerTime = providerEndTime - startTime; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onDestroy end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }, 2000); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + deleteForm: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0300 + * @tc.name: Performance test. + * @tc.desc: Release form. + */ + it(`FMS_performanceTest_0300`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0300`; + const timeout = 1000; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`release` == data.parameters.kind) { + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${hostTime}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback_release end`); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + releaseForm: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0400 + * @tc.name: Performance test. + * @tc.desc: Cast temp form. + */ + it(`FMS_performanceTest_0400`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0400`; + const timeout = 500; + let startTime = -1; + let endflag = 0; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`castTempForm` == data.parameters.kind) { + startTime = data.parameters.startTime; + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); + console.info(`${tcNumber} onAcquiredCallback_castTempForm end`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + } + }); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onCastToNormal` == kind) { + setTimeout(() => { + const providerEndTime = data.parameters.time; + const providerTime = providerEndTime - startTime; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onCastToNormal end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }, 2000); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + castTempForm: true, + temporary: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0500 + * @tc.name: Performance test. + * @tc.desc: Notify visible forms. + */ + it(`FMS_performanceTest_0500`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0500`; + const timeout = 500; + let startTime = -1; + let endflag = 0; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`notifyVisibleForms` == data.parameters.kind) { + startTime = data.parameters.startTime; + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback_notifyVisibleForms end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + } + }); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onVisibilityChange` == kind) { + setTimeout(() => { + const providerEndTime = data.parameters.time; + const providerTime = providerEndTime - startTime; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onVisibilityChange end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }, 2000); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + notifyVisibleForms: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0600 + * @tc.name: Performance test. + * @tc.desc: Notify invisible forms. + */ + it(`FMS_performanceTest_0600`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0600`; + const timeout = 500; + let startTime = -1; + let endflag = 0; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`notifyInvisibleForms` == data.parameters.kind) { + startTime = data.parameters.startTime; + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback_notifyInvisibleForms end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + } + }); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onVisibilityChange` == kind) { + setTimeout(() => { + const providerEndTime = data.parameters.time; + const providerTime = providerEndTime - startTime; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onVisibilityChange end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }, 2000); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + notifyInvisibleForms: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0700 + * @tc.name: Performance test. + * @tc.desc: Request forms. + */ + it(`FMS_performanceTest_0700`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0700`; + const timeout = 100; + let startTime = -1; + let endflag = 0; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`request` == data.parameters.kind) { + startTime = data.parameters.startTime; + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${JSON.stringify(hostTime)}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + } + }); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onUpdate` == kind) { + setTimeout(() => { + const providerEndTime = data.parameters.time; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerEndTime - startTime)}`); + expect(providerEndTime - startTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onUpdate end`); + + if (++endflag == 2) { + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }, 2000); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + requestForm: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0800 + * @tc.name: Performance test. + * @tc.desc: Update form. + */ + it(`FMS_performanceTest_0800`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0800`; + const timeout = 100; + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onUpdateForm` == kind) { + const providerTime = data.parameters.time; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onUpdateForm end`); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + notifyVisibleForms: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_0900 + * @tc.name: Performance test. + * @tc.desc: Set next refresh time. + */ + it(`FMS_performanceTest_0900`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_0900`; + const timeout = 100; + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onSetFormNextRefreshTime` == kind) { + const providerTime = data.parameters.time; + console.info(`${tcNumber} providerTime: ${JSON.stringify(providerTime)}`); + expect(providerTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + console.info(`${tcNumber} onSupplyCallback_onSetFormNextRefreshTime end`); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [supplyFormId] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }); + + setTimeout(async () => { + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + notifyVisibleForms: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }, 2000); + }); + + /** + * @tc.number: FMS_performanceTest_1000 + * @tc.name: Performance test. + * @tc.desc: Enable update forms. + */ + it(`FMS_performanceTest_1000`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_1000`; + const timeout = 100; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`enableUpdate` == data.parameters.kind) { + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${hostTime}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback_enableUpdate end`); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + enableUpdate: true, + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_1100 + * @tc.name: Performance test. + * @tc.desc: Disable update forms. + */ + it(`FMS_performanceTest_1100`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_1100`; + const timeout = 100; + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${data.data}`); + + if (`disableUpdate` == data.parameters.kind) { + const hostTime = data.parameters.hostTime; + console.info(`${tcNumber} hostTime: ${hostTime}`); + expect(hostTime < timeout).assertEqual(true); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback_disableUpdate end`); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [data.data] + } + }, () => publishOnDeleteCallback(tcNumber, done)); + }, 500); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true, + disableUpdate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_performanceTest_1300 + * @tc.name: Performance test. + * @tc.desc: Get forms info. + */ + it(`FMS_performanceTest_1300`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_1300`; + const timeout = 10; + + const startTime = await systemTime.getCurrentTime(); + const data = await formHost.getAllFormsInfo(); + console.info(`${tcNumber} getAllFormsInfo result: ${JSON.stringify(data)}`); + const endTime = await systemTime.getCurrentTime(); + + console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); + expect(endTime - startTime < timeout); + done(); + }); + + /** + * @tc.number: FMS_performanceTest_1400 + * @tc.name: Performance test. + * @tc.desc: Get forms info by bundle. + */ + it(`FMS_performanceTest_1400`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_1400`; + const timeout = 10; + + const startTime = await systemTime.getCurrentTime(); + const data = await formHost.getFormsInfo(`com.form.formsystemtestserviceg.hmservice`); + console.info(`${tcNumber} getFormsInfoByBundle result: ${JSON.stringify(data)}`); + const endTime = await systemTime.getCurrentTime(); + + console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); + expect(endTime - startTime < timeout); + done(); + }); + + /** + * @tc.number: FMS_performanceTest_1500 + * @tc.name: Performance test. + * @tc.desc: Get forms info by module. + */ + it(`FMS_performanceTest_1500`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_1500`; + const timeout = 10; + + const startTime = await systemTime.getCurrentTime(); + const data = await formHost.getFormsInfo(`com.form.formsystemtestserviceg.hmservice`, `entry`); + console.info(`${tcNumber} getFormsInfoByModule result: ${JSON.stringify(data)}`); + const endTime = await systemTime.getCurrentTime(); + + console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); + expect(endTime - startTime < timeout); + done(); + }); + + /** + * @tc.number: FMS_performanceTest_1600 + * @tc.name: Performance test. + * @tc.desc: Form System Ready. + */ + it(`FMS_performanceTest_1600`, 0, async (done) => { + const tcNumber = `FMS_performanceTest_1600`; + const timeout = 10; + + const startTime = await systemTime.getCurrentTime(); + const data = await formHost.isSystemReady(); + console.info(`${tcNumber} isSystemReady result: ${JSON.stringify(data)}`); + const endTime = await systemTime.getCurrentTime(); + + console.info(`${tcNumber} hostTime: ${JSON.stringify(endTime - startTime)}`); + expect(endTime - startTime < timeout); + done(); + }); + }); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4110aef6b0a1082d39128229a4ec0a3747dba56e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsPerformanceTest.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..183e77bfac9167306ec6b1bfae1f06a855ddd823 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormReleaseTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormReleaseTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4991ea4d2f5ee0eb0900e0b5305dc8d48e88e300 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/Test.json @@ -0,0 +1,22 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formreleasetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormReleaseTest.hap", + "FormSystemHostC.hap", + "FormSystemHostD.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd248861eeb1a25cdbd1bab32b9e266f03cf2d8a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 20000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..09d8329125cc09a8e458d579f4ecdadc32913a36 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets @@ -0,0 +1,580 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; +var onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; +var onReleasedFormEvent = { + events: ["FMS_FormOnReleased_commonEvent"], +}; +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnAcquired; +var subscriberOnDeleted; +var subscriberOnReleased; + +export default function test() { + describe(`FmsReleaseFormTest`, () => { + + beforeAll(async (done) => { + done(); + }) + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); + }) + + /** + * @tc.number: FMS_releaseForm_0200 + * @tc.name: host does not have permission + * @tc.desc: 1.release the form that formID is 1 + * 2.Verify the result is false + */ + it(`FMS_releaseForm_0200`, 0, async (done) => { + console.log(`FMS_releaseForm_0200 start`); + let formId; + + function onReleasedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0200 onReleasedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0200")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_releaseForm_0200 publish' + JSON.stringify(err)); + }); + } + + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0200 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_0200")) + formId = data.data; + commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); + + console.log(`FMS_releaseForm_0200 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "releaseForm" : true, + "releaseId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0200 featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + + console.log(`FMS_releaseForm_0200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0200 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_releaseForm_0300 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.release the form + * 2.Verify the result is false + */ + it(`FMS_releaseForm_0300`, 0, async (done) => { + console.log(`FMS_releaseForm_0300 start`); + + function onReleasedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0300 onReleasedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0300")); + setTimeout(function () { + console.info('FMS_releaseForm_0300 onReleasedCallBack end'); + console.log(`FMS_releaseForm_0300 end`); + done(); + }, 100); + } + commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); + + console.log(`FMS_releaseForm_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "releaseForm" : true, + "releaseId" : "-1", + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_releaseForm_0400 + * @tc.name: formID id is error(formID = 0) + * @tc.desc: 1.release the form + * 2.Verify the result is false + */ + it(`FMS_releaseForm_0400`, 0, async (done) => { + console.log(`FMS_releaseForm_0400 start`); + + function onReleaseCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0400 onReleaseCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0400")); + setTimeout(function () { + console.info('FMS_releaseForm_0400 onReleaseCallBack end'); + console.log(`FMS_releaseForm_0400 end`); + done(); + }, 100); + } + commonEvent.subscribe(subscriberOnReleased, onReleaseCallBack); + console.log(`FMS_releaseForm_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "releaseForm" : true, + "releaseId" : "0", + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_releaseForm_0500 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.host A create a formA + * 2.host B release the formA + * 2.Verify the result is false + */ + it(`FMS_releaseForm_0500`, 0, async (done) => { + console.log(`FMS_releaseForm_0500 start`); + let formId; + + function onReleasedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0500 onReleasedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0500")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_releaseForm_0500 publish' + JSON.stringify(err)); + }); + } + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0500 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_0500")); + formId = data.data; + commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); + console.log(`FMS_releaseForm_0500 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostd", + abilityName: "com.ohos.st.formsystemhostd.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "releaseForm" : true, + "releaseId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0500 featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_releaseForm_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_releaseForm_0600 + * @tc.name: Form ID error (FormID does not exist) + * @tc.desc: 1.host create one normal card + * 2.host delete the form + * 3.host release the form and verify the result is false + */ + it(`FMS_releaseForm_0600`, 0, async (done) => { + console.log(`FMS_releaseForm_0600 start`); + let formId; + + function onReleasedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0600 onReleasedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_0600")); + let commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_releaseForm_0600 publish' + JSON.stringify(err)); + }); + } + function onDeletedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_0600 onDeletedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnDeleted_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnDeleted, unsubscribeDeletedCallback) + formId = data.parameters.formId; + commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); + + console.log(`FMS_releaseForm_0600 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "releaseForm" : true, + "releaseId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0600 featureAbility.startAbility again end`); + } + function unsubscribeDeletedCallback() { + console.debug("====>FMS_releaseForm_0600 unsubscribeDeletedCallback====>"); + } + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallBack); + console.log(`FMS_releaseForm_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "deleteForm" : true, + "deleteId" : "self", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_0600 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_releaseForm_1300 + * @tc.name: single host continuously release forms + * @tc.desc: 1.There are 2 forms created by the single host + * 2.single host release 2 forms successfully + */ + it(`FMS_releaseForm_1300`, 0, async (done) => { + console.log(`FMS_releaseForm_1300 start`); + let formIdList = []; + let releasedIdList = []; + let formCount = 2; + let delCount = 0; + + function delPublishCallBack() { + console.info("!!!====>FMS_releaseForm_1300 delPublishCallBack====>"); + delCount++; + if(delCount == formCount) { + setTimeout(function () { + console.info('FMS_releaseForm_1300 delPublishCallBack end'); + console.log(`FMS_releaseForm_1300 end`); + done(); + }, 1000); + } + } + + function onReleasedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_1300 onReleasedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data).assertEqual("0"); + let formId = data.parameters.formId; + formIdList.forEach(function(item, index, arr) { + if(item === formId) { + releasedIdList.push(formId); + } + }); + if(releasedIdList.length == formCount) { + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeOnReleasedCallback("FMS_releaseForm_1300")); + for(var iIndex = 0; iIndex < releasedIdList.length; iIndex++) { + let commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: releasedIdList[iIndex] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + } + } + } + function releaseForms() { + console.debug("====>FMS_releaseForm_1300 releaseForms====>"); + commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); + for(var iIndex = 0; iIndex < formIdList.length; iIndex++) { + console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "releaseForm" : true, + "releaseId" : formIdList[iIndex], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); + } + } + function onAcquiredCallBack1(_, data) { + console.info("!!!====>FMS_releaseForm_1300 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_1300")); + formIdList.push(data.data); + + releaseForms(); + } + + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_1300 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_releaseForm_1300")); + formIdList.push(data.data); + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack1); + + console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + + console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_releaseForm_1400 + * @tc.name: release temp form + * @tc.desc: 1.host create one temp form + * 2.release the form and judge the result is true + */ + it(`FMS_releaseForm_1400`, 0, async (done) => { + console.log(`FMS_releaseForm_1400 start`); + + function onReleasedCallBack(_, data) { + console.info("!!!====>FMS_releaseForm_1400 onReleasedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnReleased_commonEvent"); + expect(data.data).assertEqual("0"); + let commonEventPublishData = { + bundleName: "com.ohos.st.formsystemhostc", + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_releaseForm_1400 publish' + JSON.stringify(err)); + }); + } + commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); + + console.log(`FMS_releaseForm_1400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostc", + abilityName: "com.ohos.st.formsystemhostc.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : true, + "releaseForm" : true, + "releaseId" : "self", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_releaseForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_releaseForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_releaseForm_1400 featureAbility.startAbility end`); + }); + }); +} + +const delPublishCallBack = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnReleasedCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnReleasedCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/List.test.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..142bc8cd5885c9d7ef28eb71f697b61416d45444 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormStateDisableTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormStateDisableTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f692d0dffbb74376ebad44fa6703a3d99c42c296 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/Test.json @@ -0,0 +1,25 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formstatedisabletest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormStateDisableTest.hap", + "FormSystemHostF.hap", + "FormSystemHostG.hap", + "FormSupplyAppA.hap", + "FormSupplyAppF.hap", + "FormSupplyAppG.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppH.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e94c22a605c0083ce7239782b619267ae9cc0723 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json @@ -0,0 +1,150 @@ +{ + "app": { + "bundleName": "com.ohos.st.formstatedisabletest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formstatedisabletest", + "name": ".FormStateSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent", + "reason": "need use OnDeleted commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent", + "reason": "need use OnState commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2178a7f807dc1796f20ce22def4fd33614536b2b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 30000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..49efafefa51decb23515cce68cd68a20a330f404 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets @@ -0,0 +1,793 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; + +var onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; + +var onStateFormEvent = { + events: ["FMS_FormOnState_commonEvent"], +}; + +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnAcquired; +var subscriberDel; +var subscriberOnState; +var subscriberSupply; + +export default function test() { + describe(`FmsStateFormTest`, () => { + + beforeAll(async (done) => { + done(); + }) + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberDel = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }) + + /** + * @tc.number: FMS_disableFormsUpdate_0200 + * @tc.name: The form user does not have permission. + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0200`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_0200 start`); + function onStateCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0200 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("2"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0200")); + setTimeout(function () { + console.info('FMS_disableFormsUpdate_0200 onStateCallBack end'); + console.log(`FMS_disableFormsUpdate_0200 end`); + done(); + }, 1000) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : ["1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbility again end`); + }); + /** + * @tc.number: FMS_disableFormsUpdate_0300 + * @tc.name: The length of the formId list is 0 (no formId) + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0300`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_0300 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0300 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("7"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0300")) + + setTimeout(function () { + console.info('FMS_disableFormsUpdate_0300 delPublishCallBack end'); + console.log(`FMS_disableFormsUpdate_0300 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : [], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate _0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_disableFormsUpdate_0400 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0400`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_0400 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0400 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0400")) + + setTimeout(function () { + console.info('FMS_disableFormsUpdate_0400 delPublishCallBack end'); + console.log(`FMS_disableFormsUpdate_0400 end`); + done(); + }, 100) + } + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : ["-1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate _0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_disableFormsUpdate_0500 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0500`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_0500 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0500 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0500")) + + setTimeout(function () { + console.info('FMS_disableFormsUpdate_0500 delPublishCallBack end'); + console.log(`FMS_disableFormsUpdate_0500 end`); + done(); + }, 100) + } + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : ["0"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_disableFormsUpdate_0600 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0600`, 0, async (done) => { + console.info(`FMS_disableFormsUpdate_0600 start`); + let hostFormId; + + const onDisableCallback = (_, data) => { + if (data.parameters.kind != "disable") { + return; + } + console.debug("====>FMS_disableFormsUpdate_0600 onDisableCallback data:====>" + JSON.stringify(data)); + + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnDisableCallback("FMS_disableFormsUpdate_0600")); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_disableFormsUpdate_0600")); + const commonEventPublishData = { + data: hostFormId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_disableFormsUpdate_0600 publish' + JSON.stringify(err)); + }); + } + + const onAcquiredCallBack = async (_, data) => { + console.debug("====>FMS_disableFormsUpdate_0600 onAcquiredCallback data:====>" + JSON.stringify(data)); + hostFormId = data.data; + + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": hostFormId, + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "disable", + "stateIds": [hostFormId], + "isCreate": false + } + } + }).then((res: any) => { + console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_disableFormsUpdate_0600")); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + commonEvent.subscribe(subscriberOnState, onDisableCallback); + console.info(`FMS_disableFormsUpdate_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + /** + * @tc.number: FMS_disableFormsUpdate_0700 + * @tc.name: formID id is error because formId is not exist + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0700`, 0, async (done) => { + console.info(`FMS_disableFormsUpdate_0700 start`); + let hostFormId; + + const onDisableCallback = (_, data) => { + if (data.parameters.kind != "disable") { + return; + } + console.debug("====>FMS_disableFormsUpdate_0700 onDisableCallback data:====>" + JSON.stringify(data)); + + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info("====>FMS_disableFormsUpdate_0700 unSubscribeOnDisableCallback====>"); + }); + done(); + } + + const onDeleteCallback = async (_, data) => { + console.debug("====>FMS_disableFormsUpdate_0700 onDeleteCallback data:====>" + JSON.stringify(data)); + hostFormId = data.parameters.formId; + + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "disable", + "stateIds": [hostFormId], + "isCreate": false + } + } + }).then((res: any) => { + console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + commonEvent.unsubscribe(subscriberDel, () => { + console.info("====>FMS_disableFormsUpdate_0700 unSubscribeDelCallback====>"); + }); + } + + commonEvent.subscribe(subscriberDel, onDeleteCallback); + commonEvent.subscribe(subscriberOnState, onDisableCallback); + console.info(`FMS_disableFormsUpdate_0700 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "deleteForm": true, + "deleteId": "self", + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + /** + * @tc.number: FMS_disableFormsUpdate_0800 + * @tc.name: The form user has form permission. + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0800`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_0800 start`); + let formId; + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0800 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + formId = data.parameters.formId; + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0800")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_disableFormsUpdate_0800 publish' + JSON.stringify(err)); + }); + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_disableFormsUpdate_0900 + * @tc.name: There are correct and wrong formId in the form ID parameter list. + * @tc.desc: 1.The form user calls the disable update interface. + * 2.Verify the result of the disable update interface. + */ + it(`FMS_disableFormsUpdate_0900`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_0900 start`); + let formId; + + function OnDisableCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0900 OnDisableCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnDisableCallback("FMS_disableFormsUpdate_0900")); + + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_disableFormsUpdate_0900 publish' + JSON.stringify(err)); + }); + } + async function OnEnableCallBack(_, data) { + console.info("!!!====>FMS_disableFormsUpdate_0900 OnEnableCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnEnableCallback("FMS_disableFormsUpdate_0900")); + formId = data.parameters.formId; + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, OnDisableCallBack); + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : [formId, "0"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility end`); + } + + commonEvent.subscribe(subscriberOnState, OnEnableCallBack); + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_disableFormsUpdate_1000 + * @tc.name: Set next refresh time is invalid when disable form. (cache data < 1k) + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Call the disableFormsUpdate interface. + * 3.Call the setFormNextRefreshTime interface and verify the form can not refresh. + */ + it(`FMS_disableFormsUpdate_1000`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_1000 start`); + let formId; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 100 }, () => { + console.log(`FMS_disableFormsUpdate_1000 time speed up`); + }); + + function onSupplyEventCallBack(_, data) { + console.debug("====>FMS_disableFormsUpdate_1000 onSupplyEventCallBack====>" + JSON.stringify(data)); + if ("onUpdate" == data.parameters.kind) { + console.debug("FMS_disableFormsUpdate_1000 error, onUpdate called."); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); + expect().assertFail(); + } + } + + function onFormDisableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_disableFormsUpdate_1000 onFormDisableCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); + expect(data.parameters.kind).assertEqual("disable"); + expect(data.data).assertEqual("0"); + + commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); + + setTimeout(() => { + // timer reset + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.log(`FMS_disableFormsUpdate_1000 time reset`); + }); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); + }, 9000); + + setTimeout(() => { + console.log(`FMS_disableFormsUpdate_1000 onFormDisableCallBack end`); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_disableFormsUpdate_1000 publish' + JSON.stringify(err)); + }); + }, 10000); + } + + async function onAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1000")); + console.debug("====>FMS_disableFormsUpdate_1000 onAcquiredCallBack====>" + JSON.stringify(data)); + expect(data.parameters.kind).assertEqual("visible"); + expect(data.data).assertEqual("0"); + formId = data.parameters.formId; + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility notify disable start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : [formId], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility notify disable end`); + } + + commonEvent.subscribe(subscriberOnState, onAcquiredCallBack); + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicef.hmservice", + "ability" : "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true, + "stateIds" : ["self"], + "stateForm" : "visible" + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility servicea end`); + }); + + /** + * @tc.number: FMS_disableFormsUpdate_1100 + * @tc.name: Set next refresh time is invalid when disable form. (cache data > 1k) + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Call the disableFormsUpdate interface. + * 3.Call the setFormNextRefreshTime interface and verify the form can not refresh. + */ + it(`FMS_disableFormsUpdate_1100`, 0, async (done) => { + console.log(`FMS_disableFormsUpdate_1100 start`); + let formId; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 100 }, () => { + console.log(`FMS_disableFormsUpdate_1100 time speed up`); + }); + + function onSupplyEventCallBack(_, data) { + console.debug("====>FMS_disableFormsUpdate_1100 onSupplyEventCallBack====>" + JSON.stringify(data)); + if ("onUpdate" == data.parameters.kind) { + console.debug("FMS_disableFormsUpdate_1100 error, onUpdate called."); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); + expect().assertFail(); + } + } + + function onFormDisableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_disableFormsUpdate_1100 onFormDisableCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); + expect(data.parameters.kind).assertEqual("disable"); + expect(data.data).assertEqual("0"); + + commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); + + setTimeout(() => { + // timer reset + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.log(`FMS_disableFormsUpdate_1100 time reset`); + }); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); + }, 9000); + + setTimeout(() => { + console.log(`FMS_disableFormsUpdate_1100 onFormDisableCallBack end`); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_disableFormsUpdate_1100 publish' + JSON.stringify(err)); + }); + }, 10000); + } + + async function onAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_disableFormsUpdate_1100")); + console.debug("====>FMS_disableFormsUpdate_1100 onAcquiredCallBack====>" + JSON.stringify(data)); + expect(data.parameters.kind).assertEqual("visible"); + expect(data.data).assertEqual("0"); + formId = data.parameters.formId; + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility notify disable start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : [formId], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility notify disable end`); + } + + commonEvent.subscribe(subscriberOnState, onAcquiredCallBack); + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviceg.hmservice", + "ability" : "com.form.formsystemtestserviceg.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true, + "stateIds" : ["self"], + "stateForm" : "visible" + } + } + }).then((res: any) => { + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility servicea end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnStateCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); +} + +const unsubscribeOnDisableCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnDisableCallback====>`); +} + +const unsubscribeOnEnableCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnEnableCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d9c46ec7a281e0c405cb9f267f7c856c859ce3e9 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsFormStateDisable.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..39fe2a50ceccda9ee33a9a5498f376f592fdd74f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formdisablestatetest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f1789b1697ae98b62042e4e71bb6e2665907b282 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormStateEnableTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormStateEnableTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6de3637f2fd1edb97c32d70be810f0d81879bb55 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json @@ -0,0 +1,25 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formstateenabletest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormStateEnableTest.hap", + "FormSystemHostF.hap", + "FormSystemHostG.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap", + "FormSupplyAppE.hap", + "FormSupplyAppF.hap", + "FormSupplyAppH.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5f7229632a2ddbdac75b86e5fa4296bba0cfbf7a --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json @@ -0,0 +1,150 @@ +{ + "app": { + "bundleName": "com.ohos.st.formstateenabletest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formstateenabletest", + "name": ".FormStateSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent", + "reason": "need use OnDeleted commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent", + "reason": "need use OnState commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2178a7f807dc1796f20ce22def4fd33614536b2b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 30000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..26a756d3ccb9b94d9dfa4432687e71ae9758a78b --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets @@ -0,0 +1,904 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; + +var onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; + +var onStateFormEvent = { + events: ["FMS_FormOnState_commonEvent"], +}; + +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnAcquired; +var subscriberDel; +var subscriberOnState; +var subscriberSupply; + +export default function test() { + describe(`FmsStateFormTest`, () => { + + beforeAll(async (done) => { + done(); + }) + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberDel = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }) + + /** + * @tc.number: FMS_enableFormsUpdate_0200 + * @tc.name: The form user does not have permission. + * @tc.desc: 1.The form user calls the enable update interface. + * 2.Verify the result of the enable update interface. + */ + it(`FMS_enableFormsUpdate_0200`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_0200 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_enableFormsUpdate_0200 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("2"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0200")); + setTimeout(function () { + console.info('FMS_enableFormsUpdate_0200 onStateCallBack end'); + console.log(`FMS_enableFormsUpdate_0200 end`); + done(); + }, 1000); + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : ["1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbility again end`); + }); + /** + * @tc.number: FMS_enableFormsUpdate_0300 + * @tc.name: The length of the formId list is 0 (no formId) + * @tc.desc: 1.The form user calls the enable update interface. + * 2.Verify the result of the enable update interface. + */ + it(`FMS_enableFormsUpdate_0300`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_0300 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_enableFormsUpdate_0300 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("7"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0300")) + + setTimeout(function () { + console.info('FMS_enableFormsUpdate_0300 delPublishCallBack end'); + console.log(`FMS_enableFormsUpdate_0300 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : [], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_enableFormsUpdate_0400 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form user calls the enable update interface. + * 2.Verify the result of the enable update interface. + */ + it(`FMS_enableFormsUpdate_0400`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_0400 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_enableFormsUpdate_0400 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0400")) + + setTimeout(function () { + console.info('FMS_enableFormsUpdate_0400 delPublishCallBack end'); + console.log(`FMS_enableFormsUpdate_0400 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : ["-1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_enableFormsUpdate_0500 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form user calls the enable update interface. + * 2.Verify the result of the enable update interface. + */ + it(`FMS_enableFormsUpdate_0500`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_0500 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_enableFormsUpdate_0500 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0500")) + + setTimeout(function () { + console.info('FMS_enableFormsUpdate_0500 delPublishCallBack end'); + console.log(`FMS_enableFormsUpdate_0500 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : ["0"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_enableFormsUpdate_0600 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form user calls the enable update interface. + * 2.Verify the result of the enable update interface. + */ + it(`FMS_enableFormsUpdate_0600`, 0, async (done) => { + console.info(`FMS_enableFormsUpdate_0600 start`); + let hostFormId; + + const onEnableCallback = (_, data) => { + if (data.parameters.kind != "enable") { + return; + } + console.debug("====>FMS_enableFormsUpdate_0600 onEnableCallback data:====>" + JSON.stringify(data)); + + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0600")); + const commonEventPublishData = { + data: hostFormId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_enableFormsUpdate_0600 publish' + JSON.stringify(err)); + }); + } + + const onAcquiredCallBack = async (_, data) => { + console.debug("====>FMS_enableFormsUpdate_0600 onAcquiredCallback data:====>" + JSON.stringify(data)); + hostFormId = data.data; + + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": hostFormId, + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "enable", + "stateIds": [hostFormId], + "isCreate": false + } + } + }).then((res: any) => { + console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_enableFormsUpdate_0600")); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + commonEvent.subscribe(subscriberOnState, onEnableCallback); + console.info(`FMS_enableFormsUpdate_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + /** + * @tc.number: FMS_enableFormsUpdate_0700 + * @tc.name: formID id is error because formId is not exist + * @tc.desc: 1.The form user calls the enable update interface. + * 2.Verify the result of the enable update interface. + */ + it(`FMS_enableFormsUpdate_0700`, 0, async (done) => { + console.info(`FMS_enableFormsUpdate_0700 start`); + let hostFormId; + + const onEnableCallback = (_, data) => { + if (data.parameters.kind != "enable") { + return; + } + console.debug("====>FMS_enableFormsUpdate_0700 onEnableCallback data:====>" + JSON.stringify(data)); + + expect(data.data).assertEqual("13"); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info("====>FMS_enableFormsUpdate_0700 unSubscribeOnEnableCallback====>"); + }); + done(); + } + + const onDeleteCallback = async (_, data) => { + console.debug("====>FMS_enableFormsUpdate_0700 onDeleteCallback data:====>" + JSON.stringify(data)); + hostFormId = data.parameters.formId; + + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "enable", + "stateIds": [hostFormId], + "isCreate": false + } + } + }).then((res: any) => { + console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + commonEvent.unsubscribe(subscriberDel, () => { + console.info("====>FMS_enableFormsUpdate_0700 unSubscribeDelCallback====>"); + }); + } + + commonEvent.subscribe(subscriberDel, onDeleteCallback); + commonEvent.subscribe(subscriberOnState, onEnableCallback); + console.info(`FMS_enableFormsUpdate_0700 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "deleteForm": true, + "deleteId": "self", + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + + /** + * @tc.number: FMS_enableFormsUpdate_0900 + * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_enableFormsUpdate_0900`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_0900 start`); + let formIds = []; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 300 }, () => { + console.log(`FMS_enableFormsUpdate_0900 time speed up`); + }); + + function onUpdateCallBack(_, data) { + if (data.parameters.kind == "onUpdate") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_0900 onUpdateCallBack====>" + JSON.stringify(data)); + expect(data.parameters.parameters).assertEqual(formIds[0]); + + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); + + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.log(`FMS_enableFormsUpdate_0900 time reset`); + }); + + setTimeout(() => { + let commonEventPublishData = { + data: formIds[0] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_enableFormsUpdate_0900 publish' + JSON.stringify(err)); + }); + }, 2000); + } + } + + function onFormEnableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_0900 onFormEnableCallBack====>" + JSON.stringify(data)); + expect(data.parameters.formId).assertEqual(formIds[0]); + expect(data.parameters.kind).assertEqual("enable"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); + } + + async function onFormDisableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_0900 onFormDisableCallBack====>" + JSON.stringify(data)); + expect(data.parameters.formId).assertEqual(formIds[0]); + expect(data.parameters.kind).assertEqual("disable"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, onFormEnableCallBack); + commonEvent.subscribe(subscriberSupply, onUpdateCallBack); + + setTimeout(async () => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notifyVisible start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notifyVisible end`); + }, 10000); + } + + async function onAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_0900")); + console.debug("====>FMS_enableFormsUpdate_0900 onAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + + commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notify disable start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notify disable end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicee.hmservice", + "ability" : "com.form.formsystemtestservicee.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility servicea end`); + }); + + /** + * @tc.number: FMS_enableFormsUpdate_1000 + * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_enableFormsUpdate_1000`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_1000 start`); + let formIds = []; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 300 }, () => { + console.log(`FMS_enableFormsUpdate_1000 time speed up`); + }); + + function onUpdateCallBack(_, data) { + if (data.parameters.kind == "onUpdate") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_1000 onUpdateCallBack====>" + JSON.stringify(data)); + expect(data.parameters.parameters).assertEqual(formIds[0]); + + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); + + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.log(`FMS_enableFormsUpdate_1000 time reset`); + }); + + setTimeout(() => { + let commonEventPublishData = { + data: formIds[0] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_enableFormsUpdate_1000 publish' + JSON.stringify(err)); + }); + }, 2000); + } + } + + function onFormEnableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_1000 onFormEnableCallBack====>" + JSON.stringify(data)); + expect(data.parameters.formId).assertEqual(formIds[0]); + expect(data.parameters.kind).assertEqual("enable"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); + } + + async function onFormDisableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_1000 onFormDisableCallBack====>" + JSON.stringify(data)); + expect(data.parameters.formId).assertEqual(formIds[0]); + expect(data.parameters.kind).assertEqual("disable"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, onFormEnableCallBack); + commonEvent.subscribe(subscriberSupply, onUpdateCallBack); + + setTimeout(async () => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notifyVisible start`); + formIds.push("0"); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notifyVisible end`); + }, 10000); + } + + function onAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1000")); + console.debug("====>FMS_enableFormsUpdate_1000 onAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notify disable start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notify disable end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicee.hmservice", + "ability" : "com.form.formsystemtestservicee.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility servicea end`); + }); + + /** + * @tc.number: FMS_enableFormsUpdate_1200 + * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be visible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_enableFormsUpdate_1200`, 0, async (done) => { + console.log(`FMS_enableFormsUpdate_1200 start`); + let formIds = new Array(); + let count = 0; + + // timer speed up + commonEvent.publish(`fms.time_speed`, { code: 300 }, () => { + console.log(`FMS_enableFormsUpdate_1200 time speed up`); + }); + + function delPublishCallBack1(_, data) { + console.info("!!!====>FMS_enableFormsUpdate_1200 delPublishCallBack1====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_enableFormsUpdate_1200 delPublishCallBack1 end'); + console.log(`FMS_enableFormsUpdate_1200 end`); + }, 1000); + } + function delPublishCallBack2(_, data) { + console.info("!!!====>FMS_enableFormsUpdate_1200 delPublishCallBack2====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_enableFormsUpdate_1200 delPublishCallBack2 end'); + console.log(`FMS_enableFormsUpdate_1200 end`); + done(); + }, 1000); + } + + function onUpdateCallBack(_, data) { + if (data.parameters.kind == "onUpdate") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_1200 onUpdateCallBack====>" + JSON.stringify(data)); + expect(formIds.includes(data.parameters.parameters)).assertEqual(true); + + ++count; + if (count == 2) { + console.debug("====>FMS_enableFormsUpdate_1200 OK====>"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); + + commonEvent.publish(`fms.time_speed`, { code: 1 }, () => { + console.log(`FMS_enableFormsUpdate_1200 time reset`); + }); + + setTimeout(() => { + let commonEventPublishData1 = { + data: formIds[0] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); + let commonEventPublishData2 = { + data: formIds[1] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); + }, 2000); + } + } + } + + function onFormEnableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_1200 onFormEnableCallBack====>" + JSON.stringify(data)); + expect(data.parameters.kind).assertEqual("enable"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); + } + + async function onFormDisableCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + console.debug("====>FMS_enableFormsUpdate_1200 onFormDisableCallBack====>" + JSON.stringify(data)); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, onFormEnableCallBack); + commonEvent.subscribe(subscriberSupply, onUpdateCallBack); + setTimeout(async () => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notifyVisible start`); + formIds.push("0"); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "enable", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notifyVisible end`); + }, 10000); + } + + async function onSecondAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); + console.debug("====>FMS_enableFormsUpdate_1200 onSecondAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + console.debug("====>FMS_enableFormsUpdate_1200 formIds====>" + formIds); + + commonEvent.subscribe(subscriberOnState, onFormDisableCallBack); + + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notify disable start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "disable", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notify disable end`); + } + + async function onFirstAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_enableFormsUpdate_1200")); + console.debug("====>FMS_enableFormsUpdate_1200 onFirstAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onSecondAcquiredCallBack); + + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility serviceb start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviceh.hmservice", + "ability" : "com.form.formsystemtestserviceh.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility serviceb end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onFirstAcquiredCallBack); + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicee.hmservice", + "ability" : "com.form.formsystemtestservicee.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility servicea end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnStateCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ef8fc567980e48b7165dcabe2d23a62387d3d25 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsFormStateEnable.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f89b18b0ba85f13d834eacfda58eafc0e7e8a190 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formenablestatetest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e39eb2d6222d2952d78503442a5312dde4fa3d88 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormStateNotifyInvisibleTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormStateNotifyInvisibleTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5f8892ba8fc3f3d08887af022084092abed28d1c --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formstatenotifyinvisibletest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormStateNotifyInvisibleTest.hap", + "FormSystemHostF.hap", + "FormSystemHostG.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap", + "FormSupplyAppF.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5c76a92a593b3599aa950bd05f08d2ffd0ff5bb2 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json @@ -0,0 +1,150 @@ +{ + "app": { + "bundleName": "com.ohos.st.formstatenotifyinvisibletest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formstatenotifyinvisibletest", + "name": ".FormStateSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent", + "reason": "need use OnDeleted commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent", + "reason": "need use OnState commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ec7ce2d67c2b0adc3a0d326487f4d4ca61477d6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 10000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d24d94f6efa42913aa3d7adf15d968178371e9fa --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets @@ -0,0 +1,544 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { describe, beforeEach, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; + +var onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; + +var onStateFormEvent = { + events: ["FMS_FormOnState_commonEvent"], +}; + +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnAcquired; +var subscriberDel; +var subscriberOnState; +var subscriberSupply; + +export default function test() { + describe(`FmsStateFormTest`, () => { + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberDel = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }) + + /** + * @tc.number: FMS_notifyInvisibleForms_0200 + * @tc.name: The form user does not have permission. + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0200`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0200 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0200 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("2"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0200")); + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_0200 onStateCallBack end'); + console.log(`FMS_notifyInvisibleForms_0200 end`); + done(); + }, 1000) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : ["1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0200 featureAbility.startAbility again end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_0300 + * @tc.name: The length of the formId list is 0 (no formId) + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0300`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0300 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0300 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("7"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0300")) + + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_0300 delPublishCallBack end'); + console.log(`FMS_notifyInvisibleForms_0300 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_0400 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0400`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0400 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0400 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0400")) + + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_0400 delPublishCallBack end'); + console.log(`FMS_notifyInvisibleForms_0400 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : ["-1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_0500 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0500`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0500 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0500 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0500")) + + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_0500 delPublishCallBack end'); + console.log(`FMS_notifyInvisibleForms_0500 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : ["0"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_0600 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0600`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0600 start`); + let formId; + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0600 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0600")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_notifyInvisibleForms_0600 publish' + JSON.stringify(err)); + }); + } + + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0600 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyInvisibleForms_0600")) + formId = data.data; + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [formId], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_0700 + * @tc.name: form has been deleted + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0700`, 0, async (done) => { + console.info(`FMS_notifyInvisibleForms_0700 start`); + let hostFormId; + + const onSupplyCallback = (_, data) => { + if (data.parameters.kind != "onVisibilityChange") { + return; + } + console.debug("====>FMS_notifyInvisibleForms_0700 onSupplyCallback data:====>" + JSON.stringify(data)); + expect().assertFail(); + } + + const onInvisibleCallback = (_, data) => { + if (data.parameters.kind != "invisible") { + return; + } + console.debug("====>FMS_notifyInvisibleForms_0700 onInvisibleCallback data:====>" + JSON.stringify(data)); + + expect(data.data).assertEqual("0"); + expect(data.parameters.formId).assertEqual(hostFormId); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0700")); + setTimeout(() => { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_0700")); + done(); + }, 2000); + } + + const onDeleteCallback = async (_, data) => { + console.debug("====>FMS_notifyInvisibleForms_0700 onDeleteCallback data:====>" + JSON.stringify(data)); + hostFormId = data.parameters.formId; + + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "invisible", + "stateIds": [hostFormId], + "isCreate": false + } + } + }).then((res: any) => { + console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + commonEvent.unsubscribe(subscriberDel, () => { + console.info("====>FMS_notifyInvisibleForms_0700 unSubscribeDelCallback====>"); + }); + } + + commonEvent.subscribe(subscriberDel, onDeleteCallback); + commonEvent.subscribe(subscriberOnState, onInvisibleCallback); + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + console.info(`FMS_notifyInvisibleForms_0700 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "deleteForm": true, + "deleteId": "self", + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_0800 + * @tc.name: The form provider is the system application and config When form visiblenotify is true, + * the form provider can be notified that the form is invisible. + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0800`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0800 start`); + let formIdInvisible; + let formIdVisible; + let onSupplyCount = 0; + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyInvisibleForms_0800 onSupplyCallBack====>" + JSON.stringify(data)); + onSupplyCount++; + if (onSupplyCount == 2) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_0800")); + } + if (formIdInvisible && formIdVisible) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_notifyInvisibleForms_0800 publish' + JSON.stringify(err)); + }); + } + } + } + + function OnInvisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0800 OnInvisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + formIdInvisible = data.parameters.formId; + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0800")); + if (formIdInvisible && formIdVisible && onSupplyCount == 2) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_notifyInvisibleForms_0600 publish' + JSON.stringify(err)); + }); + } + } + async function onVisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0800 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0800")); + formIdVisible = data.parameters.formId; + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [formIdVisible], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0800 featureAbility.startAbility end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnStateCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9391dbd80597a299d846e9d810a30383fa7c1734 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsFormStateNotifyInvisible.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..88745269a1a6e8a7046797f5ad4941c07bb3d1df --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "forminvisiblestatetest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a9c532b5372d3a94deb7c01cdeb0aaa9acc03663 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormStateNotifyInvisible2Test") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormStateNotifyInvisible2Test" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c5dcc8507dc85b88693929e20da4bbfa905f59dc --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json @@ -0,0 +1,24 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formstatenotifyinvisibletest2", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormStateNotifyInvisible2Test.hap", + "FormSystemHostG.hap", + "FormSupplyAppA.hap", + "FormSupplyAppB.hap", + "FormSupplyAppD.hap", + "FormSupplyAppF.hap", + "FormSupplyAppNS.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a9d89444883243131e69d2b47c089f2c68cbd394 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json @@ -0,0 +1,150 @@ +{ + "app": { + "bundleName": "com.ohos.st.formstatenotifyinvisibletest2", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formstatenotifyinvisibletest2", + "name": ".FormStateSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent", + "reason": "need use OnDeleted commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent", + "reason": "need use OnState commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ec7ce2d67c2b0adc3a0d326487f4d4ca61477d6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 10000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e24fc901dc854c8163d12a37cdaf228f31eb8c2 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets @@ -0,0 +1,821 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; + +var onStateFormEvent = { + events: ["FMS_FormOnState_commonEvent"], +}; + +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnAcquired; +var subscriberOnState; +var subscriberSupply; + +export default function test() { + + describe(`FmsStateFormTest`, () => { + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }) + + /** + * @tc.number: FMS_notifyInvisibleForms_0900 + * @tc.name: There are correct and wrong formId in the form ID parameter list + * that informs that the form is invisible. + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_0900`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_0900 start`); + let formIdInvisible; + let formIdVisible; + let onSupplyCount = 0; + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyInvisibleForms_0900 onSupplyCallBack====>" + JSON.stringify(data)); + onSupplyCount++; + if (onSupplyCount == 2) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_0900")); + } + if (formIdInvisible && formIdVisible) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_notifyInvisibleForms_0900 publish' + JSON.stringify(err)); + }); + } + } + } + + function OnInvisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0900 OnInvisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + formIdInvisible = data.parameters.formId; + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0900")); + if (formIdInvisible && formIdVisible && onSupplyCount == 2) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { + console.info('FMS_notifyInvisibleForms_0900 publish' + JSON.stringify(err)); + }); + } + } + async function onVisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_0900 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_0900")); + formIdVisible = data.parameters.formId; + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [formIdVisible, "0"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_1000 + * @tc.name: When the form provider is not a system application, notify the form to be invisible + * and do not pull up the form provider. + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_1000`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_1000 start`); + + function onVisibleCallBack(_, data) { + if (data.parameters.kind != "invisible") { + return; + } + console.info("!!!====>FMS_notifyInvisibleForms_1000 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + + setTimeout(function () { + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1000")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1000")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, () => delPublishCallback("FMS_notifyInvisibleForms_1000",done)); + }, 2000); + } + function onSupplyEventCallBack(_, data) { + if (data.parameters.kind != "onVisibilityChange") { + return; + } + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1000")); + console.debug("====>FMS_notifyInvisibleForms_1000 onSupplyEventCallBack====>" + JSON.stringify(data)); + console.log(`FMS_notifyInvisibleForms_1000 error`); + expect().assertFail(); + } + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); + console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicenotsysapp.hmservice", + "ability" : "com.form.formsystemtestservicenotsysapp.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_1100 + * @tc.name: When formVisibleNotify is false in config.json, + * the form provider will not be pulled when the card is invisible. + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_1100`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_1100 start`); + let supplyFlag = false; + let formIdInvisible; + let formIdVisible; + + function delPublishCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1100 delPublishCallBack====>"); + setTimeout(function () { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1100")); + if (supplyFlag) { + expect().assertFail(); + } + console.info('FMS_notifyInvisibleForms_1100 delPublishCallBack end'); + console.log(`FMS_notifyInvisibleForms_1100 end`); + done(); + }, 1000); + } + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyInvisibleForms_1100 onSupplyCallBack====>" + JSON.stringify(data)); + supplyFlag = true; + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1100")); + + if (formIdInvisible && formIdVisible) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + } + } + } + + function OnInvisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1100 OnInvisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + formIdInvisible = data.parameters.formId; + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1100")); + if (formIdInvisible && formIdVisible) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + } + } + async function onVisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1100 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1100")); + formIdVisible = data.parameters.formId; + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); + + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviced.hmservice", + "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [formIdVisible], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviced.hmservice", + "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_1200 + * @tc.name: When formVisibleNotify in config.json is true, + * the provider can be notified of the visibility of the form. + * @tc.desc: 1. The form is created successfully. + * 2. The invisible interface is invoked successfully, + * and the visibility notification of form providers A and B is triggered. + * The formId is the same as the created formId, and the visibility status is invisible. + */ + it(`FMS_notifyInvisibleForms_1200`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_1200 start`); + let formId1; + let formId2; + let delCount = 0; + let onSupplyCount = 0; + + function delPublishCallBack() { + console.info("!!!====>FMS_notifyInvisibleForms_1200 delPublishCallBack====>"); + delCount++; + if (delCount == 2) { + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_1200 delPublishCallBack end'); + console.info('FMS_notifyInvisibleForms_1200 end'); + done(); + }, 500); + } + } + function onAcquiredCallBack_Normal1(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1200 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) + formId1 = data.data; + + FMS_notifyInvisibleForms_1200_normal2(); + } + function unSubscribeOnAcquiredCallBack_Normal1() { + console.debug("====>FMS_notifyInvisibleForms_1200 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"); + } + + async function FMS_notifyInvisibleForms_1200_normal1() { + console.log(`FMS_notifyInvisibleForms_1200_normal1 start`); + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); + console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility end`); + console.log(`FMS_notifyInvisibleForms_1200_normal1 end`); + } + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1200")) + console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack formId1:====>" + formId1); + console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack formId2:====>" + formId2); + console.info("!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack onSupplyCount:====>" + onSupplyCount); + if (formId1 && formId2 && onSupplyCount == 2) { + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + let commonEventPublishData2 = { + data: formId2 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); + } + } + + async function onAcquiredCallBack_Normal2(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1200 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2); + formId2 = data.data; + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [formId1, formId2], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1200 featureAbility.startAbility end`); + } + function unSubscribeOnAcquiredCallBack_Normal2() { + console.debug("====>FMS_notifyInvisibleForms_1200 unSubscribeOnAcquiredCallBack_Normal2====>"); + } + async function FMS_notifyInvisibleForms_1200_normal2() { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); + console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviceb.hmservice", + "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility end`); + } + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyInvisibleForms_1200 onSupplyCallBack====>" + JSON.stringify(data)); + let parameters = JSON.parse(data.parameters.parameters); + if(parameters[formId1]) { + expect(parameters[formId1]).assertEqual(2); + } + if(parameters[formId2]) { + expect(parameters[formId2]).assertEqual(2); + } + + onSupplyCount++; + if (onSupplyCount == 2) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1200")); + } + if (formId1 && formId2) { + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + let commonEventPublishData2 = { + data: formId2 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); + } + } + } + + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + FMS_notifyInvisibleForms_1200_normal1(); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_1300 + * @tc.name: When formVisibleNotify is true in config.json, + * the form provider will be pulled when the card is invisible. + * @tc.desc: 1.The form user calls the invisible notification interface. + * 2.Verify the result of the invisible notification interface. + */ + it(`FMS_notifyInvisibleForms_1300`, 0, async (done) => { + console.info(`FMS_notifyInvisibleForms_1300 start`); + let hostFormId; + let providerFormId; + let counter = 0; + + const delPublishCallback = (_, data) => { + console.info("!!!====>FMS_notifyInvisibleForms_1300 delPublishCallback====>"); + setTimeout(() => { + expect(hostFormId).assertEqual(providerFormId); + console.info('FMS_notifyInvisibleForms_1300 delPublishCallback end'); + console.info(`FMS_notifyInvisibleForms_1300 end`); + done(); + }, 1000); + } + + const onSupplyCallback = (_, data) => { + if (data.parameters.kind != "onVisibilityChange") { + return; + } + console.debug("====>FMS_notifyInvisibleForms_1300 onSupplyCallback data:====>" + JSON.stringify(data)); + providerFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[providerFormId]; + + expect(visibilityStatus).assertEqual(2); + commonEvent.unsubscribe(subscriberSupply, () => { + console.info("====>FMS_notifyInvisibleForms_1300 unSubscribeSupplyCallback====>"); + }); + if (++counter == 2) { + const commonEventPublishData = { + data: providerFormId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + } + } + + const onInvisibleCallback = (_, data) => { + if (data.parameters.kind != "invisible") { + return; + } + console.debug("====>FMS_notifyInvisibleForms_1300 onInvisibleCallback data:====>" + JSON.stringify(data)); + hostFormId = data.parameters.formId; + + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info("====>FMS_notifyInvisibleForms_1300 unSubscribeOnInvisibleCallback====>"); + }); + if (++counter == 2) { + const commonEventPublishData = { + data: hostFormId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + } + } + + commonEvent.subscribe(subscriberOnState, onInvisibleCallback); + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + console.info(`FMS_notifyInvisibleForms_1300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "invisible", + "stateIds": ["self"], + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + + /** + * @tc.number: FMS_notifyInvisibleForms_1400 + * @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyInvisibleForms_1400`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_1400 start`); + let formIds = new Array(); + let count = 0; + + function delPublishCallBack1(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1400 delPublishCallBack1====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_1400 delPublishCallBack1 end'); + console.log(`FMS_notifyInvisibleForms_1400 end`); + }, 1000); + } + function delPublishCallBack2(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1400 delPublishCallBack2====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_1400 delPublishCallBack2 end'); + console.log(`FMS_notifyInvisibleForms_1400 end`); + done(); + }, 1000); + } + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyInvisibleForms_1400 onSupplyCallBack====>" + JSON.stringify(data)); + + let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; + expect(formIds.includes(retFormId)).assertTrue(); + expect(visibilityStatus).assertEqual(2); + + ++count; + if (count == 2) { + console.debug("====>FMS_notifyInvisibleForms_1400 OK====>"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1400")); + + let commonEventPublishData1 = { + data: formIds[0] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); + let commonEventPublishData2 = { + data: formIds[1] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); + } + } + } + + async function onSecondAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1400")); + console.debug("====>FMS_notifyInvisibleForms_1400 onSecondAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + formIds.push("-1"); + console.debug("====>FMS_notifyInvisibleForms_1400 formIds====>" + formIds); + + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible end`); + } + + async function onFirstAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyInvisibleForms_1400")); + console.debug("====>FMS_notifyInvisibleForms_1400 onFirstAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onSecondAcquiredCallBack); + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviceb.hmservice", + "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onFirstAcquiredCallBack); + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea end`); + }); + /** + * @tc.number: FMS_notifyInvisibleForms_1500 + * @tc.name: The size of invisible form ids in the notification form array exceeds 32. + * @tc.desc: 1. Failed to invoke the invisibility interface (parameter error). + */ + it(`FMS_notifyInvisibleForms_1500`, 0, async (done) => { + console.log(`FMS_notifyInvisibleForms_1500 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyInvisibleForms_1500 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("7"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyInvisibleForms_1500")) + + setTimeout(function () { + console.info('FMS_notifyInvisibleForms_1500 delPublishCallBack end'); + console.log(`FMS_notifyInvisibleForms_1500 end`); + done(); + }, 100) + } + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : [ + "1","2","3","4","5","6","7","8","9","10","11","12","13","14", + "15","16","17","18","19","20","21","22","23","24","25","26", + "27","28","29","30","31","32","33" + ], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbility end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnStateCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..119c54c57de04d31ca7c48d53f521157a65ace7f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsFormStateNotifyInvisible2.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..88745269a1a6e8a7046797f5ad4941c07bb3d1df --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "forminvisiblestatetest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f3068bd2113bf7895b789370e6de0eaa0496030c --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormStateNotifyVisibleTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormStateNotifyVisibleTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..29fa626d8be8b7a545bf439c66d21a39f35c8ef8 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json @@ -0,0 +1,29 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formstatenotifyvisibletest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormStateNotifyVisibleTest.hap", + "FormSystemHostF.hap", + "FormSystemHostG.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap", + "FormSupplyAppB.hap", + "FormSupplyAppD.hap", + "FormSupplyAppE.hap", + "FormSupplyAppF.hap", + "FormSupplyAppG.hap", + "FormSupplyAppH.hap", + "FormSupplyAppNS.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..15e46578e801e592ec2410e2473e1d477c66052e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json @@ -0,0 +1,150 @@ +{ + "app": { + "bundleName": "com.ohos.st.formstatenotifyvisibletest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formstatenotifyvisibletest", + "name": ".FormStateSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnState_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent", + "reason": "need use OnDeleted commonEvent" + }, + { + "name": "FMS_FormOnState_commonEvent", + "reason": "need use OnState commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ec7ce2d67c2b0adc3a0d326487f4d4ca61477d6 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 10000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c71d84f71b72105d2d4fe6a5e77be3d13068974 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets @@ -0,0 +1,1383 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; + +var onStateFormEvent = { + events: ["FMS_FormOnState_commonEvent"], +}; + +var onSupplyEvent = { + events: ["FMS_FormSupply_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + +var subscriberOnAcquired; +var subscriberOnState; +var subscriberSupply; + +export default function test() { + describe(`FmsStateFormTest`, () => { + + beforeAll(async (done) => { + done(); + }) + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + await sleep(1000); + }) + + + /** + * @tc.number: FMS_notifyVisibleForms_0200 + * @tc.name: The form user does not have permission. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_0200`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_0200 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0200 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("2"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0200")); + setTimeout(function () { + console.info('FMS_notifyVisibleForms_0200 onStateCallBack end'); + console.log(`FMS_notifyVisibleForms_0200 end`); + done(); + }, 1000) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0200 featureAbility.startAbility again end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_0300 + * @tc.name: The length of the formId list is 0 (no formId) + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_0300`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_0300 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0300 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("7"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0300")); + + setTimeout(function () { + console.info('FMS_notifyVisibleForms_0300 delPublishCallBack end'); + console.log(`FMS_notifyVisibleForms_0300 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : [], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_0400 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_0400`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_0400 start`); + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0400 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0400")) + + setTimeout(function () { + console.info('FMS_notifyVisibleForms_0400 delPublishCallBack end'); + console.log(`FMS_notifyVisibleForms_0400 end`); + done(); + }, 100) + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["-1"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_0500 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_0500`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_0500 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0500 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0500")) + + setTimeout(function () { + console.info('FMS_notifyVisibleForms_0500 delPublishCallBack end'); + console.log(`FMS_notifyVisibleForms_0500 end`); + done(); + }, 100); + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["0"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_0600 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_0600`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_0600 start`); + let formId; + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0600 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0600")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_0600", done)); + } + async function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0600 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyVisibleForms_0600")) + formId = data.data; + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : [formId], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0600 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_0700 + * @tc.name: Form ID error (FormID does not exist) + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_0700`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_0700 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_0700 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_0700")); + + setTimeout(function () { + console.info('FMS_notifyVisibleForms_0700 onStateCallBack end'); + console.log(`FMS_notifyVisibleForms_0700 end`); + done(); + }, 100); + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["123456789"], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_0700 featureAbility.startAbility again end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_1000 + * @tc.name: The form provider is the system application and config When form visiblenotify is true, + * the form provider can be notified that the form is visible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1000`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1000 start`); + let formIdInvisible; + let formIdVisible; + let onSupplyCount = 0; + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyVisibleForms_1000 onSupplyCallBack====>" + JSON.stringify(data)); + onSupplyCount++; + if (onSupplyCount == 2) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1000")); + } + if (formIdInvisible && formIdVisible) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_1000", done)); + } + } + } + + function onVisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1000 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + formIdVisible = data.parameters.formId; + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1000")); + if (formIdInvisible && formIdVisible && onSupplyCount == 2) { + let commonEventPublishData = { + data: formIdInvisible + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_1000", done)); + } + } + async function OnInvisibleCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1000 OnInvisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1000")) + formIdInvisible = data.parameters.formId; + + subscriberOnState = await commonEvent.createSubscriber(onStateFormEvent); + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility again start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : [formIdInvisible], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility again end`); + } + + commonEvent.subscribe(subscriberOnState, OnInvisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "invisible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1000 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_1100 + * @tc.name: Use 0 and created form card Id notify the form to be visible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1100`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1100 start`); + let assertFormId; + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1100")); + console.debug("====>FMS_notifyVisibleForms_1100 onSupplyCallBack====>" + JSON.stringify(data)); + let formId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[formId]; + expect(formId).assertEqual(assertFormId); + expect(visibilityStatus).assertEqual(1); + + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_1000", done)); + } + } + + function onVisibleCallBack(_, data) { + if (data.parameters.kind != "visible") { + return; + } + console.info("!!!====>FMS_notifyVisibleForms_1100 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + assertFormId = data.parameters.formId; + + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1100")); + } + + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["self", "0"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1100 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_notifyVisibleForms_1200 + * @tc.name: When the form provider is not a system application, notify the form to be visible + * and do not pull up the form provider. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1200`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1200 start`); + + function onVisibleCallBack(_, data) { + if (data.parameters.kind != "visible") { + return; + } + console.info("!!!====>FMS_notifyVisibleForms_1200 onVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + + setTimeout(function () { + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1200")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1200")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_1200", done)); + }, 2000); + } + function onSupplyEventCallBack(_, data) { + if (data.parameters.kind != "onVisibilityChange") { + return; + } + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1200")); + console.debug("====>FMS_notifyVisibleForms_1200 onSupplyEventCallBack====>" + JSON.stringify(data)); + console.log(`FMS_notifyVisibleForms_1200 error`); + expect().assertFail(); + } + + commonEvent.subscribe(subscriberOnState, onVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onSupplyEventCallBack); + console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicenotsysapp.hmservice", + "ability" : "com.form.formsystemtestservicenotsysapp.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1200 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_notifyVisibleForms_1300 + * @tc.name: Provider onVisibleChange can not be called when formVisibleNotify is false. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the onVisibleChange interface. + */ + it(`FMS_notifyVisibleForms_1300`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1300 start`); + + function OnVisibleCallBack(_, data) { + if (data.parameters.kind != "visible") { + return; + } + console.info("!!!====>FMS_notifyVisibleForms_1300 OnVisibleCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1300")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_1300", done)); + } + + commonEvent.subscribe(subscriberOnState, OnVisibleCallBack); + console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviced.hmservice", + "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : ["self"], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_notifyVisibleForms_1400 + * @tc.name: formVisibleNotify in config.json is true, + * it can notify the form provider that the form is not visible. + * @tc.desc: 1. The card is created successfully. + * 2. The visibility interface is successfully invoked. + * The visibility notification of form provider A is triggered, + * and the formId is the same as that of the created formId. + */ + it(`FMS_notifyVisibleForms_1400`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1400 start`); + let supplyFlag = false; + let formId1; + let formId2; + let delCount = 0; + let onSupplyCount = 0; + + function delPublishCallBack() { + console.info("!!!====>FMS_notifyVisibleForms_1400 delPublishCallBack====>"); + delCount++; + if (delCount == 2) { + setTimeout(function () { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1400")); + if (supplyFlag) { + expect().assertFail(); + } + console.info('FMS_notifyVisibleForms_1400 delPublishCallBack end'); + console.info('FMS_notifyVisibleForms_1400 end'); + done(); + }, 1000); + } + } + function onAcquiredCallBack_Normal1(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1400 onAcquiredCallBack_Normal1 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal1) + formId1 = data.data; + + FMS_notifyVisibleForms_1400_normal2(); + } + function unSubscribeOnAcquiredCallBack_Normal1() { + console.debug("====>FMS_notifyVisibleForms_1400 unSubscribeOnAcquiredCallBack_Normal2====>"); + } + async function FMS_notifyVisibleForms_1400_normal1() { + console.log(`FMS_notifyVisibleForms_1400_normal1 start`); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal1); + console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.log(`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbility end`); + console.log(`FMS_notifyVisibleForms_1400_normal1 end`); + } + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1400")) + console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack formId1:====>" + formId1); + console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack formId2:====>" + formId2); + console.info("!!!====>FMS_notifyVisibleForms_1400 onStateCallBack onSupplyCount:====>" + onSupplyCount); + if (formId1 && formId2 && onSupplyCount == 1) { + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + let commonEventPublishData2 = { + data: formId2 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); + } + } + + async function onAcquiredCallBack_Normal2(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1400 onAcquiredCallBack_Normal2 data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, unSubscribeOnAcquiredCallBack_Normal2); + formId2 = data.data; + + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + + console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : [formId1,formId2], + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1400 featureAbility.startAbility end`); + } + function unSubscribeOnAcquiredCallBack_Normal2() { + console.debug("====>FMS_notifyVisibleForms_1400 unSubscribeOnAcquiredCallBack_Normal2====>"); + } + async function FMS_notifyVisibleForms_1400_normal2() { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack_Normal2); + console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviced.hmservice", + "ability" : "com.form.formsystemtestserviced.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + + console.log(`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbility end`); + } + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyVisibleForms_1400 onSupplyCallBack====>" + JSON.stringify(data)); + let parameters = JSON.parse(data.parameters.parameters); + if(parameters[formId1]) { + expect(parameters[formId1]).assertEqual(1); + } + if(parameters[formId2]) { + expect(parameters[formId2]).assertEqual(1); + } + + onSupplyCount++; + if (onSupplyCount == 2) { + supplyFlag = true; + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1400")); + } + + if (formId1 && formId2) { + let commonEventPublishData = { + data: formId1 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallBack); + let commonEventPublishData2 = { + data: formId2 + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack); + } + } + } + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + FMS_notifyVisibleForms_1400_normal1(); + }); + /** + * @tc.number: FMS_notifyVisibleForms_1500 + * @tc.name: Created provider A and B form card, notify the form to be visible 3times. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1500`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1500 start`); + let formIds = new Array(); + let count = 0; + + function delPublishCallBack1(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1500 delPublishCallBack1====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_notifyVisibleForms_1500 delPublishCallBack1 end'); + console.log(`FMS_notifyVisibleForms_1500 end`); + }, 1000); + } + function delPublishCallBack2(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1500 delPublishCallBack2====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_notifyVisibleForms_1500 delPublishCallBack2 end'); + console.log(`FMS_notifyVisibleForms_1500 end`); + done(); + }, 1000); + } + + function onInVisibleSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyVisibleForms_1500 onInVisibleSupplyCallBack====>" + JSON.stringify(data)); + + let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; + expect(formIds.includes(retFormId)).assertTrue(); + expect(visibilityStatus).assertEqual(2); + + ++count; + if (count == 12) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); + let commonEventPublishData1 = { + data: formIds[0] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); + let commonEventPublishData2 = { + data: formIds[1] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); + } + } + } + + async function onVisibleSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyVisibleForms_1500 onVisibleSupplyCallBack====>" + JSON.stringify(data)); + + let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; + expect(formIds.includes(retFormId)).assertTrue(); + expect(visibilityStatus).assertEqual(1); + + ++count; + if (count == 6) { + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); + subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); + commonEvent.subscribe(subscriberSupply, onInVisibleSupplyCallBack); + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyInvisible start`); + for (var i = 0; i < 3; i++) { + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "stateForm": "invisible", + "stateIds": formIds, + "isCreate": false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + } + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyInvisible end`); + } + } + } + + async function onAcquiredCallBack2(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); + console.debug("====>FMS_notifyVisibleForms_1500 onAcquiredCallBack2====>" + JSON.stringify(data)); + formIds.push(data.data); + console.debug("====>FMS_notifyVisibleForms_1500 formIds====>" + formIds); + + commonEvent.subscribe(subscriberSupply, onVisibleSupplyCallBack); + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyVisible start`); + for (var i = 0; i < 3; i++) { + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "stateForm": "visible", + "stateIds": formIds, + "isCreate": false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + } + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyVisible end`); + } + + async function onAcquiredCallBack1(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); + console.debug("====>FMS_notifyVisibleForms_1500 onAcquiredCallBack1====>" + JSON.stringify(data)); + formIds.push(data.data); + console.debug("====>FMS_notifyVisibleForms_1500 formIds====>" + JSON.stringify(formIds)); + + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack2); + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility serviceb start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviceb.hmservice", + "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility serviceb end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack1); + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1500 featureAbility.startAbility servicea end`); + }); + + /** + * @tc.number: FMS_notifyVisibleForms_1600 + * @tc.name: Use -1 and created form card Id notify the form to be visible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1600`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1600 start`); + let formIds = new Array(); + let count = 0; + + function delPublishCallBack1(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1600 delPublishCallBack1====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_notifyVisibleForms_1600 delPublishCallBack1 end'); + console.log(`FMS_notifyVisibleForms_1600 end`); + }, 1000); + } + function delPublishCallBack2(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1600 delPublishCallBack2====>" + JSON.stringify(data)); + setTimeout(function () { + console.info('FMS_notifyVisibleForms_1600 delPublishCallBack2 end'); + console.log(`FMS_notifyVisibleForms_1600 end`); + done(); + }, 1000); + } + + function onSupplyCallBack(_, data) { + if (data.parameters.kind == "onVisibilityChange") { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + console.debug("====>FMS_notifyVisibleForms_1600 onSupplyCallBack====>" + JSON.stringify(data)); + + let retFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[retFormId]; + expect(formIds.includes(retFormId)).assertTrue(); + expect(visibilityStatus).assertEqual(1); + + ++count; + if (count == 2) { + console.debug("====>FMS_notifyVisibleForms_1600 OK====>"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1500")); + + let commonEventPublishData1 = { + data: formIds[0] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData1, delPublishCallBack1); + let commonEventPublishData2 = { + data: formIds[1] + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData2, delPublishCallBack2); + } + } + } + + async function onSecondAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyVisibleForms_1500")); + console.debug("====>FMS_notifyVisibleForms_1600 onSecondAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + formIds.push("-1"); + console.debug("====>FMS_notifyVisibleForms_1600 formIds====>" + formIds); + + commonEvent.subscribe(subscriberSupply, onSupplyCallBack); + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility notifyVisible start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "name", + "bundle" : "bundle", + "ability" : "ability", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : formIds, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility notifyVisible end`); + } + + async function onFirstAcquiredCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_notifyVisibleForms_1500")); + console.debug("====>FMS_notifyVisibleForms_1600 onFirstAcquiredCallBack====>" + JSON.stringify(data)); + formIds.push(data.data); + + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + commonEvent.subscribe(subscriberOnAcquired, onSecondAcquiredCallBack); + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility serviceb start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestserviceb.hmservice", + "ability" : "com.form.formsystemtestserviceb.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility serviceb end`); + } + + commonEvent.subscribe(subscriberOnAcquired, onFirstAcquiredCallBack); + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1600 featureAbility.startAbility servicea end`); + }); + + /** + * @tc.number: FMS_notifyVisibleForms_1700 + * @tc.name: Use -1 and created form card Id notify the form to be visible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1700`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1700 start`); + + function onFormVisibleCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1700")); + console.debug("====>FMS_notifyVisibleForms_1700 onFirstAcquiredCallBack====>" + JSON.stringify(data)); + expect(data.parameters.kind).assertEqual("visible"); + expect(data.data).assertEqual("0"); + + setTimeout(function () { + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallback("FMS_notifyVisibleForms_1700", done)); + }, 2000); + } + + function onFormSupplyCallBack(_, data) { + expect(data.event).assertEqual("FMS_FormSupply_commonEvent"); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeSupplyCallback("FMS_notifyVisibleForms_1700")); + console.debug("====>FMS_notifyVisibleForms_1700 onFormSupplyCallBack====>" + JSON.stringify(data)); + if (data.parameters.kind == "onVisibilityChange") { + console.debug("====>FMS_notifyVisibleForms_1700 error"); + expect().assertFail(); + } + } + + commonEvent.subscribe(subscriberOnState, onFormVisibleCallBack); + commonEvent.subscribe(subscriberSupply, onFormSupplyCallBack); + console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbility servicea start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true, + "isStartOtherApp" : true, + "otherAppState" : "visible" + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1700 featureAbility.startAbility servicea end`); + }); + + /** + * @tc.number: FMS_notifyVisibleForms_1800 + * @tc.name: When formVisibleNotify is true in config.json, + * the form provider will be pulled when the card is visible. + * @tc.desc: 1.The form user calls the visible notification interface. + * 2.Verify the result of the visible notification interface. + */ + it(`FMS_notifyVisibleForms_1800`, 0, async (done) => { + console.info(`FMS_notifyVisibleForms_1800 start`); + let hostFormId; + let providerFormId; + let counter = 0; + + const delPublishCallback = (_, data) => { + console.info("!!!====>FMS_notifyVisibleForms_1800 delPublishCallback====>"); + setTimeout(() => { + expect(hostFormId).assertEqual(providerFormId); + console.info('FMS_notifyVisibleForms_1800 delPublishCallback end'); + console.info(`FMS_notifyVisibleForms_1800 end`); + done(); + }, 1000); + } + + const onSupplyCallback = (_, data) => { + if (data.parameters.kind != "onVisibilityChange") { + return; + } + console.debug("====>FMS_notifyVisibleForms_1800 onSupplyCallback data:====>" + JSON.stringify(data)); + providerFormId = Object.keys(JSON.parse(data.parameters.parameters))[0]; + const visibilityStatus = JSON.parse(data.parameters.parameters)[providerFormId]; + + expect(visibilityStatus).assertEqual(1); + commonEvent.unsubscribe(subscriberSupply, () => { + console.info("====>FMS_notifyVisibleForms_1800 unSubscribeSupplyCallback====>"); + }); + if (++counter == 2) { + const commonEventPublishData = { + data: providerFormId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + } + } + + const onVisibleCallback = (_, data) => { + if (data.parameters.kind != "visible") { + return; + } + console.debug("====>FMS_notifyVisibleForms_1800 onVisibleCallback data:====>" + JSON.stringify(data)); + hostFormId = data.parameters.formId; + + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info("====>FMS_notifyVisibleForms_1800 unSubscribeOnVisibleCallback====>"); + }); + if (++counter == 2) { + const commonEventPublishData = { + data: hostFormId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, delPublishCallback); + } + } + + commonEvent.subscribe(subscriberOnState, onVisibleCallback); + commonEvent.subscribe(subscriberSupply, onSupplyCallback); + console.info(`FMS_notifyVisibleForms_1800 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId": "0", + "name": "Form_Js001", + "bundle": "com.form.formsystemtestservicef.hmservice", + "ability": "com.form.formsystemtestservicef.hmservice.FormAbility", + "moduleName": "entry", + "temporary": false, + "stateForm": "visible", + "stateIds": ["self"], + "isCreate": true + } + } + }).then((res: any) => { + console.debug(`FMS_notifyVisibleForms_1800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.debug(`FMS_notifyVisibleForms_1800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + }); + /** + * @tc.number: FMS_notifyVisibleForms_1900 + * @tc.name: The size of visible form ids in the notification form array exceeds 32. + * @tc.desc: 1. Failed to invoke the visibility interface (parameter error). + */ + it(`FMS_notifyVisibleForms_1900`, 0, async (done) => { + console.log(`FMS_notifyVisibleForms_1900 start`); + + function onStateCallBack(_, data) { + console.info("!!!====>FMS_notifyVisibleForms_1900 onStateCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_notifyVisibleForms_1900")) + + setTimeout(function () { + console.info('FMS_notifyVisibleForms_1900 delPublishCallBack end'); + console.log(`FMS_notifyVisibleForms_1900 end`); + done(); + }, 100); + } + + commonEvent.subscribe(subscriberOnState, onStateCallBack); + console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostg", + abilityName: "com.ohos.st.formsystemhostg.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.FormAbility", + "moduleName" : "entry", + "temporary" : false, + "stateForm" : "visible", + "stateIds" : [ + "1","2","3","4","5","6","7","8","9","10","11","12","13","14", + "15","16","17","18","19","20","21","22","23","24","25","26", + "27","28","29","30","31","32","33" + ], + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_notifyVisibleForms_1900 featureAbility.startAbility end`); + }); + }); +} + +const sleep = async delay => { + return new Promise((resolve, _) => { + setTimeout(async () => { + resolve(0); + }, delay); + }); +}; + +const delPublishCallback = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000); +} + +const unsubscribeOnStateCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnStateCallback====>`); +} + +const unsubscribeSupplyCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unSubscribeSupplyCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnAcquiredCallback====>`); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..349440c8034730cdabf5117b7b2a4f6edf81b636 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsFormStateNotifyVisible.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..63cba75d54d0fc140df672f33a824d6dd3b746f7 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formvisiblestatetest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6221047d9f177d609ced81cb02f1839d462fe406 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormStressTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormStressTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..229c7ae975abd8c373c77a4de3dc1d67668f012f --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/Test.json @@ -0,0 +1,21 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "360000", + "package": "com.ohos.st.formstresstest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormStressTest.hap", + "FormSystemHostK.hap", + "FormSupplyAppF.hap", + "FormSupplyAppG.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7f1a408596d20cd773dfebf460e0da76443e7deb --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json @@ -0,0 +1,169 @@ +{ + "app": { + "bundleName": "com.ohos.st.formstresstest", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.st.formstresstest", + "name": ".FormStressSTApp", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnDeleted_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnAcquired_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnError_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormCast_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormSupply_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "FMS_FormDelete_commonEvent" + } + ], + "reqPermissions": [ + { + "name": "FMS_FormOnAcquired_commonEvent", + "reason": "need use onAcquired commonEvent" + }, + { + "name": "FMS_FormOnDeleted_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "FMS_FormOnError_commonEvent", + "reason": "need use OnError commonEvent" + }, + { + "name": "FMS_FormCast_commonEvent", + "reason": "need use castFrom commonEvent" + }, + { + "name": "FMS_FormSupply_commonEvent", + "reason": "need use FormSupply commonEvent" + }, + { + "name": "FMS_FormOnReleased_commonEvent" + }, + { + "name": "FMS_FormOnRequest_commonEvent" + }, + { + "name": "FMS_FormDelete_commonEvent", + "reason": "need use delete commonEvent" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE", + "reason": "need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES", + "reason": "need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name": "ohos.permission.CLEAN_APPLICATION_DATA" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5548b2108cd36d9ebb5068ad14d793c3ca76ae0 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + want.parameters['timeout'] = 10000; + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Stress Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..803ce1074ce04577db4f05d0648bec2c0913fd52 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets @@ -0,0 +1,601 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the `License`); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an `AS IS` BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from '@ohos.ability.featureAbility'; +import formHost from '@ohos.application.formHost'; +import commonEvent from '@ohos.commonEvent'; +import { beforeEach, describe, expect, it } from 'deccjsunit/index'; + +const onDeletedEvent = { + events: [`FMS_FormOnDeleted_commonEvent`] +} +const onAcquiredEvent = { + events: [`FMS_FormOnAcquired_commonEvent`] +}; +const onSupplyEvent = { + events: [`FMS_FormSupply_commonEvent`] +}; +const formOnDeleteEvent = `FMS_FormDelete_commonEvent`; + +const unsubscribeOnDeletedCallback = (tcNumber, done) => { + console.info(`${tcNumber} unsubscribeOnDeleted Callback`); + done(); +} +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.info(`${tcNumber} unsubscribeOnAcquired Callback`); +} +const unsubscribeOnSupplyCallback = (tcNumber) => { + console.info(`${tcNumber} unsubscribeOnSupply Callback`); +} +const publishOnDeleteCallback = (tcNumber) => { + console.info(`${tcNumber} publishOnDelete Callback`); +} + +let onDeletedEventSubscriber; +let onAcquiredEventSubscriber; +let onSupplyEventSubscriber; + +export default function test() { + describe(`FmsStressTest`, () => { + + beforeEach(async () => { + onDeletedEventSubscriber = await commonEvent.createSubscriber(onDeletedEvent); + onAcquiredEventSubscriber = await commonEvent.createSubscriber(onAcquiredEvent); + onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); + }); + + const subscribeDeletedEvent = (tcNumber, expectedDeletedFormAmount, done) => { + commonEvent.subscribe(onDeletedEventSubscriber, async (err, data) => { + const formIds = data.parameters.formIds; + const deletedFormAmount = data.parameters.deletedFormAmount; + console.info(`${tcNumber} onDeletedCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onDeletedCallback formIds: ${formIds}`); + + expect(expectedDeletedFormAmount).assertEqual(deletedFormAmount); + expect(err.code).assertEqual(0); + console.info(`${tcNumber} onDeletedCallback end`); + commonEvent.unsubscribe(onDeletedEventSubscriber, () => unsubscribeOnDeletedCallback(tcNumber, done)); + }); + } + + /** + * @tc.number: FMS_stressTest_0100 + * @tc.name: Create form test. + * @tc.desc: OnCreate form interface working well. + */ + it(`FMS_stressTest_0100`, 0, async (done) => { + const tcNumber = `FMS_stressTest_0100`; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const formId = data.data; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + expect(err.code).assertEqual(0); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(formId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onAcquiredCallback end`); + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_0200 + * @tc.name: Host release form test. + * @tc.desc: releaseForm method working well. + */ + it(`FMS_stressTest_0200`, 0, async (done) => { + const tcNumber = `FMS_stressTest_0200`; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const formId = data.parameters.formId; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + expect(err.code).assertEqual(0); + if (`release` == kind) { + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry`, + isCreate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + } else { + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(formId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onAcquiredCallback end`); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry`, + releaseForm: true, + isCreate: true, + temporary: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_0300 + * @tc.name: Host cast temp form test. + * @tc.desc: castTempForm method working well. + */ + it(`FMS_stressTest_0300`, 0, async (done) => { + const tcNumber = `FMS_stressTest_0300`; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const formId = data.parameters.formId; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + expect(err.code).assertEqual(0); + if (`castTempForm` == kind) { + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: formId, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry` + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(formId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onAcquiredCallback end`); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry`, + castTempForm: true, + isCreate: true, + temporary: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_0500 + * @tc.name: Provider set form next refresh time test. + * @tc.desc: setFormNextRefreshTime method working well. + */ + it(`FMS_stressTest_0500`, 0, async (done) => { + const tcNumber = `FMS_stressTest_0500`; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onSetFormNextRefreshTime` == kind) { + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(supplyFormId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onSupplyCallback end`); + } + }); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const formId = data.parameters.formId; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + if (`notifyVisibleForms` == kind) { + expect(err.code).assertEqual(0); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback end`); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + notifyVisibleForms: true, + isCreate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_0700 + * @tc.name: Host request form test. + * @tc.desc: requestForm method working well. + */ + it(`FMS_stressTest_0700`, 0, async (done) => { + const tcNumber = `FMS_stressTest_0700`; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const formId = data.parameters.formId; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + if (`request` == kind) { + expect(err.code).assertEqual(0); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(formId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onAcquiredCallback end`); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestservicef.hmservice`, + ability: `com.form.formsystemtestservicef.hmservice.FormAbility`, + moduleName: `entry`, + requestForm: true, + isCreate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_0900 + * @tc.name: Provider update form test. + * @tc.desc: updateForm method working well. + */ + it(`FMS_stressTest_0900`, 0, async (done) => { + const tcNumber = `FMS_stressTest_0900`; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onUpdateForm` == kind) { + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(supplyFormId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onSupplyCallback end`); + } + }); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const formId = data.parameters.formId; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + if (`notifyVisibleForms` == kind) { + expect(err.code).assertEqual(0); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback end`); + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + notifyVisibleForms: true, + isCreate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_1100 + * @tc.name: Host notify form's visibility test. + * @tc.desc: notifyVisibleForms and notifyInvisibleForms method working well. + */ + it(`FMS_stressTest_1100`, 0, async (done) => { + const tcNumber = `FMS_stressTest_1100`; + let hostCounter = 0; + let providerCounter = 0; + + subscribeDeletedEvent(tcNumber, 1, done); + + commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => { + console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + const kind = data.parameters.kind; + const supplyFormId = `onCreate` == kind + ? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`] + : `onVisibilityChange` == kind + ? Object.keys(JSON.parse(data.parameters.parameters))[0] + : data.parameters.parameters; + console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`); + + if (`onVisibilityChange` == kind) { + if (++providerCounter == 2) { + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber)); + setTimeout(() => { + commonEvent.publish(formOnDeleteEvent, { + parameters: { + formIds: [].concat(supplyFormId) + } + }, () => publishOnDeleteCallback(tcNumber)); + }, 500); + console.info(`${tcNumber} onSupplyCallback end`); + } + } + }); + + commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => { + const kind = data.parameters.kind; + const formId = data.parameters.formId; + console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`); + console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`); + + if (`notifyVisibleForms` == kind) { + expect(err.code).assertEqual(0); + if (++hostCounter == 2) { + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback end`); + } + } else if (`notifyInvisibleForms` == kind) { + expect(err.code).assertEqual(0); + if (++hostCounter == 2) { + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber)); + console.info(`${tcNumber} onAcquiredCallback end`); + } + } + }); + + try { + const res = await featureAbility.startAbility({ + want: { + bundleName: `com.ohos.st.formsystemhostk`, + abilityName: `com.ohos.st.formsystemhostk.MainAbility`, + parameters: { + formId: `0`, + name: `Form_Js001`, + bundle: `com.form.formsystemtestserviceg.hmservice`, + ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`, + moduleName: `entry`, + notifyVisibility: true, + isCreate: true + } + } + }); + console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`); + } catch (error) { + console.info(`${tcNumber} error: ${JSON.stringify(error)}`); + console.info(`${tcNumber} should not reach here`); + expect().assertFail(); + } + }); + + /** + * @tc.number: FMS_stressTest_1700 + * @tc.name: Get forms info test. + * @tc.desc: getAllFormsInfo and getFormsInfo method working well. + */ + it(`FMS_stressTest_1700`, 0, async (done) => { + const tcNumber = `FMS_stressTest_1700`; + + let allFormsInfo = await formHost.getAllFormsInfo(); + const providerBundleNameList = [ + `com.form.formsystemtestservicef.hmservice`, + `com.form.formsystemtestserviceg.hmservice` + ]; + + console.info(`${tcNumber} getAllFormsInfo: ${JSON.stringify(allFormsInfo)}`); + console.info(`${tcNumber} before filter size: ${JSON.stringify(allFormsInfo.length)}`); + allFormsInfo = allFormsInfo.filter((formsInfo) => providerBundleNameList.includes(formsInfo.bundleName)); + console.info(`${tcNumber} after filter size: ${JSON.stringify(allFormsInfo.length)}`); + expect(allFormsInfo.length).assertEqual(3); + + allFormsInfo.forEach(async (formsInfo, index) => { + const providerFormsInfo1 = await formHost.getFormsInfo(formsInfo.bundleName); + const providerFormsInfo2 = await formHost.getFormsInfo(formsInfo.bundleName, formsInfo.moduleName); + + console.info(`${tcNumber} getFormsInfo: ${JSON.stringify(providerFormsInfo1)}`); + console.info(`${tcNumber} getFormsInfo: ${JSON.stringify(providerFormsInfo2)}`); + expect(providerFormsInfo1[0].bundleName).assertEqual(providerFormsInfo2[0].bundleName); + + if (index == allFormsInfo.length - 1) { + done(); + } + }); + }); + + + /** + * @tc.number: FMS_stressTest_1800 + * @tc.name: Form system ready test. + * @tc.desc: isSystemReady method working well. + */ + it(`FMS_stressTest_1800`, 0, async (done) => { + const tcNumber = `FMS_stressTest_1800`; + + const systemstatus = await formHost.isSystemReady(); + console.info(`${tcNumber} systemstatus: ${JSON.stringify(systemstatus)}`); + expect(systemstatus).assertEqual(0); + done(); + }); + }); +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b32987f930d4d886f3c1552409a7c8a5883f871 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test from './FmsStress.test.ets'; + +export default function testsuite() { + test(); +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/BUILD.gn b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..df641072b5f46ecb6205fbe80cf3c63369b2704e --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFormUpdateRefreshTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsFormUpdateRefreshTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c74674296ea7dbd1eb7089fd6220afee83fd17a1 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/Test.json @@ -0,0 +1,22 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.ohos.st.formupdaterefreshtest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsFormUpdateRefreshTest.hap", + "FormSystemHostE.hap", + "FormSystemHostF.hap", + "FormSystemHostNoPerm.hap", + "FormSupplyAppA.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..11c5d70c4f3b21c318de8032595862856e849485 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/app.ets @@ -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('[FormComponent] Application onCreate') + }, + onDestroy() { + console.info('[FormComponent] Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd535b4d476a15433fc062a0416c86f3e389c7c3 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility"; +import file from '@system.file'; +import { Core, ExpectExtend, ReportExtend } from "deccjsunit/index"; +import testsuite from "../test/List.test.ets"; + +@Entry +@Component +struct Index { + + aboutToAppear() { + + console.info("[FormComponent] start run testcase!!!!"); + + featureAbility.getWant() + .then((want: any) => { + console.info('[FormComponent] Operation successful. Data: ' + JSON.stringify(want)); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); + configService.setConfig(want.parameters); + testsuite(); + core.execute(); + }) + .catch((error: any) => { + console.error('[FormComponent] Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Fms Main Ability Test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..213a31c19a3582eb306e87ccdfd483f129344972 --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets @@ -0,0 +1,720 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; + +var onAcquiredForm_Event = { + events: ["FMS_FormOnAcquired_commonEvent"], +}; +var onDeletedFormEvent = { + events: ["FMS_FormOnDeleted_commonEvent"], +}; +var onUpdateRefreshEvent = { + events: ["FMS_FormUpdateRefresh_commonEvent"], +}; +var onRequestFormEvent = { + events: ["FMS_FormOnRequest_commonEvent"], +}; + +var deleteForm_Event = "FMS_FormDelete_commonEvent"; + + +var subscriberOnAcquired; +var subscriberOnDeleted; +var subscriberOnRefresh; +var subscriberOnRequest; + +export default function test() { + describe(`FmsUpdateRefreshFormTest`, () => { + + beforeAll(async (done) => { + done(); + }) + + beforeEach(async () => { + subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); + subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); + subscriberOnRefresh = await commonEvent.createSubscriber(onUpdateRefreshEvent); + subscriberOnRequest = await commonEvent.createSubscriber(onRequestFormEvent); + }) + + /** + * @tc.number: FMS_updateForm_0100 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_updateForm_0100`, 0, async (done) => { + console.log(`FMS_updateForm_0100 start`); + + function onRefreshCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0100 onRefreshCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0100")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_updateForm_0100", done)); + } + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); + console.log(`FMS_updateForm_0100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "updateForm" : true, + "updateId" : "-1", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0100 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_updateForm_0200 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_updateForm_0200`, 0, async (done) => { + console.log(`FMS_updateForm_0200 start`); + + function onRefreshCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0200 onRefreshCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0200")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_updateForm_0200", done)); + done(); + } + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); + console.log(`FMS_updateForm_0200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "updateForm" : true, + "updateId" : "0", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0200 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_updateForm_0300 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form provider B to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_updateForm_0300`, 0, async (done) => { + console.log(`FMS_updateForm_0300 start`); + let formId; + + function onRefreshCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0300 onRefreshCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0300")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_updateForm_0300", done)); + done(); + } + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0300 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_updateForm_0300")); + formId = data.data; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); + + console.log(`FMS_updateForm_0300 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "updateForm" : true, + "updateId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0300 featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_updateForm_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_updateForm_0400 + * @tc.name: Form ID error (FormID does not exist) + * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_updateForm_0400`, 0, async (done) => { + console.log(`FMS_updateForm_0400 start`); + let formId; + + function onRefreshCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0400 onRefreshCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0400")); + setTimeout(function () { + console.info('FMS_updateForm_0400 onRefreshCallBack end'); + console.log(`FMS_updateForm_0400 end`); + done(); + }, 1000); + } + function onDeletedCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0400 onDeletedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnDeleted_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeDeletedCallback("FMS_updateForm_0400")); + formId = data.parameters.formId; + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); + + console.log(`FMS_updateForm_0400 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "updateForm" : true, + "updateId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0400 featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallBack); + console.log(`FMS_updateForm_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "deleteForm" : true, + "deleteId" : "self", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_updateForm_0500 + * @tc.name: The jsonData of form in the provider is empty. + * @tc.desc: 1.The form provider A to invoke the intiative timed refresh interface. + */ + it(`FMS_updateForm_0500`, 0, async (done) => { + console.log(`FMS_updateForm_0500 start`); + + function onRefreshCallBack(_, data) { + console.info("!!!====>FMS_updateForm_0500 onRefreshCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormUpdateRefresh_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeOnRefreshCallback("FMS_updateForm_0500")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_updateForm_0500", done)); + done(); + } + commonEvent.subscribe(subscriberOnRefresh, onRefreshCallBack); + console.log(`FMS_updateForm_0500 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "updateForm" : true, + "updateId" : "self", + "jsonEmpty" : true, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_updateForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_updateForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_updateForm_0500 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_hostRefresh_0100 + * @tc.name: formID id is error(formID < 0) + * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_hostRefresh_0100`, 0, async (done) => { + console.log(`FMS_hostRefresh_0100 start`); + + function onRequestCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0100 onRequestCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0100")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_hostRefresh_0100", done)); + } + commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); + console.log(`FMS_hostRefresh_0100 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "requestForm" : true, + "requestId" : "-1", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0100 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_hostRefresh_0200 + * @tc.name: formID id is error(formID == 0) + * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_hostRefresh_0200`, 0, async (done) => { + console.log(`FMS_hostRefresh_0200 start`); + + function onRequestCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0200 onRequestCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0200")); + + let commonEventPublishData = { + data: data.parameters.formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_hostRefresh_0200", done)); + done(); + } + commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); + console.log(`FMS_hostRefresh_0200 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "requestForm" : true, + "requestId" : "0", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0200 featureAbility.startAbility end`); + }); + + /** + * @tc.number: FMS_hostRefresh_0300 + * @tc.name: formID id is error because formId is not self + * @tc.desc: 1.The form user B to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_hostRefresh_0300`, 0, async (done) => { + console.log(`FMS_hostRefresh_0300 start`); + let formId; + + function onRequestCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0300 onRequestCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRefreshCallback("FMS_hostRefresh_0300")); + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, + () => delPublishCallBack("FMS_hostRefresh_0300", done)); + done(); + } + + function onAcquiredCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0300 onAcquiredCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_hostRefresh_0300")); + formId = data.data; + commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); + + console.log(`FMS_hostRefresh_0300 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "requestForm" : true, + "requestId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0300 featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); + console.log(`FMS_hostRefresh_0300 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0300 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_hostRefresh_0400 + * @tc.name: Form ID error (FormID does not exist) + * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_hostRefresh_0400`, 0, async (done) => { + console.log(`FMS_hostRefresh_0400 start`); + let formId; + + function onRequestCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0400 onRequestCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0400")); + setTimeout(function () { + console.info('FMS_hostRefresh_0400 onRequestCallBack end'); + console.log(`FMS_hostRefresh_0400 end`); + done(); + }, 10); + } + function onDeletedCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0400 onDeletedCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnDeleted_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeDeletedCallback("FMS_hostRefresh_0400")); + formId = data.parameters.formId; + commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); + + console.log(`FMS_hostRefresh_0400 featureAbility.startAbility again start`); + featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "requestForm" : true, + "requestId" : formId, + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0400 featureAbility.startAbility again end`); + } + commonEvent.subscribe(subscriberOnDeleted, onDeletedCallBack); + console.log(`FMS_hostRefresh_0400 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostf", + abilityName: "com.ohos.st.formsystemhostf.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "deleteForm" : true, + "deleteId" : "self", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0400 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_hostRefresh_0600 + * @tc.name: The form user has no form permission. + * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. + * 2.Verify the result of the intiative timed refresh interface. + */ + it(`FMS_hostRefresh_0600`, 0, async (done) => { + console.log(`FMS_hostRefresh_0600 start`); + + function onRequestCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0600 onRequestCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); + expect(data.data != "0").assertEqual(true); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0600")); + + setTimeout(function () { + console.info('FMS_hostRefresh_0600 onRequestCallBack end'); + console.log(`FMS_hostRefresh_0600 end`); + done(); + }, 1000) + } + + commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); + console.log(`FMS_hostRefresh_0600 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhostnoperm", + abilityName: "com.ohos.st.formsystemhostnoperm.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "requestForm" : true, + "requestId" : "1", + "isCreate" : false + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0600 featureAbility.startAbility end`); + }); + /** + * @tc.number: FMS_hostRefresh_0700 + * @tc.name: Refresh form successfully by the form user. + * @tc.desc: 1.The form user A to invoke the intiative timed refresh interface. + * 2.Verify that pulling up the form provider. + */ + it(`FMS_hostRefresh_0700`, 0, async (done) => { + console.log(`FMS_hostRefresh_0700 start`); + let formId; + + function onRequestCallBack(_, data) { + console.info("!!!====>FMS_hostRefresh_0700 onRequestCallBack data:====>" + JSON.stringify(data)); + expect(data.event).assertEqual("FMS_FormOnRequest_commonEvent"); + expect(data.data).assertEqual("0"); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeOnRequestCallback("FMS_hostRefresh_0700")); + formId = data.parameters.formId; + let commonEventPublishData = { + data: formId + }; + commonEvent.publish(deleteForm_Event, commonEventPublishData, () => delPublishCallBack("FMS_hostRefresh_0700", done)); + done(); + } + + commonEvent.subscribe(subscriberOnRequest, onRequestCallBack); + + console.log(`FMS_hostRefresh_0700 featureAbility.startAbility start`); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formsystemhoste", + abilityName: "com.ohos.st.formsystemhoste.MainAbility", + parameters: { + "formId" : "0", + "name" : "Form_Js001", + "bundle" : "com.form.formsystemtestservicea.hmservice", + "ability" : "com.form.formsystemtestservicea.hmservice.MainAbility", + "moduleName" : "entry", + "temporary" : false, + "requestForm" : true, + "requestId" : "self", + "isCreate" : true + } + } + }).then((res: any) => { + console.log(`FMS_hostRefresh_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); + }).catch((err: any) => { + console.log(`FMS_hostRefresh_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); + console.log(`FMS_hostRefresh_0700 featureAbility.startAbility end`); + }); + }); +} + +const delPublishCallBack = async (tcNumber, done) => { + console.info(`${tcNumber} delPublishCallBack start`); + setTimeout(function () { + console.info(`${tcNumber} delPublishCallBack end`); + done(); + }, 1000) +} + +const unsubscribeOnRequestCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnRequestCallback CallBack====>`); +} + +const unsubscribeOnRefreshCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnRefreshCallback CallBack====>`); +} + +const unsubscribeDeletedCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeDeletedCallback====>`); +} + +const unsubscribeOnAcquiredCallback = (tcNumber) => { + console.debug(`====>${tcNumber} unsubscribeOnAcquiredCallback CallBack====>`); +} diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be88fb57ccf5fe22f6052ba0214cb897047fed1d --- /dev/null +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formsttest" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/signature/openharmony_sx.p7b b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/signature/openharmony_sx.p7b rename to ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/app.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7ec9f66f20585c191fa771440f9c0b6ce2f3849f --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.acts.killprocesswithaccountpackage", + "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/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/element/string.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ab5874b3563a523bebb88cbb68d53fcd94889f09 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsKillProcessWithAccountRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsKillProcessWithAccountRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actskillprocesswithaccountrelyhap_js_assets", + ":actskillprocesswithaccountrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actskillprocesswithaccountrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actskillprocesswithaccountrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actskillprocesswithaccountrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actskillprocesswithaccountrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/Test.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3dc930c509f1ef885ac4f9623d7e9585990fd5b --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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("MainAbilityT onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbilityT onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbilityT onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbilityT onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbilityT onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbilityT onBackground") + } +}; diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..6bcf8cc50e5744c28ddbecff85eff36c52292f62 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "com.acts.killprocesswithaccountpackage", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.killprocesswithaccountpackage.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/signature/openharmony_sx.p7b b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/signature/openharmony_sx.p7b rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/app.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/app.json rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/app.json diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/BUILD.gn b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/BUILD.gn rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/BUILD.gn diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/Test.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/Test.json rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/Test.json diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac47d00494b16c09bd134739568348c4a60a9bf3 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('停止进程') + .fontSize(60) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/signature/openharmony_sx.p7b b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountTest/signature/openharmony_sx.p7b rename to ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/BUILD.gn b/ability/ability_runtime/killprocesswithaccountstage/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/BUILD.gn rename to ability/ability_runtime/killprocesswithaccountstage/BUILD.gn diff --git a/aafwk/aafwk_standard/newwant/BUILD.gn b/ability/ability_runtime/newwant/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/BUILD.gn rename to ability/ability_runtime/newwant/BUILD.gn diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/BUILD.gn b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/BUILD.gn rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/BUILD.gn diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/config.json b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/config.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/config.json rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/config.json diff --git a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/app.js b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..f052c8a909b68f6e497443771496a070ecbccb1c --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/en-US.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/zh-CN.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.css old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.hml old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.hml diff --git a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2b9f6f6691f15f6773cd981d6de18614c57f1cd8 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,85 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import { Core, ExpectExtend } from 'deccjsunit/index' +import featureAbility from '@ohos.ability.featureAbility' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + console.info('ACTS_NewWant Api7 onInit'); + this.title = "ProcessManageSystemAppA"; + }, + onReady() { + console.info('ACTS_NewWant Api7 onReady'); + }, + onActive() { + console.info('ACTS_NewWant Api7 onActive'); + }, + async onShow() { + console.info('ACTS_NewWant Api7 onShow'); + + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.SecondAbility", + action: "restartSecondAbility0800", + }, + } + ); + + }, + onInactive() { + console.info('ACTS_NewWant Api7 onInactive'); + }, + onHide() { + console.info('ACTS_NewWant Api7 onHide'); + }, + onDestroy() { + console.info('ACTS_NewWant Api7 onDestroy'); + }, + onBackPress() { + console.info('ACTS_NewWant Api7 onBackPress'); + }, + onNewRequest() { + console.info('ACTS_NewWant Api7 onNewRequest'); + }, + onStartContinuation() { + console.info('ACTS_NewWant Api7 onStartContinuation'); + }, + onSaveData(value) { + console.info('ACTS_NewWant Api7 onSaveData:' + JSON.stringify(value)); + }, + onRestoreData(value) { + console.info('ACTS_NewWant Api7 onRestoreData:' + JSON.stringify(value)); + }, + onCompleteContinuation(code) { + console.info('ACTS_NewWant Api7 onCompleteContinuation:' + JSON.stringify(code)); + }, + onConfigurationUpdated(configuration) { + console.info('ACTS_NewWant Api7 onConfigurationUpdated:' + JSON.stringify(configuration)); + } +} + diff --git a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/newwant/actsnewwantapi7relyhap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/AppScope/app.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/AppScope/app.json rename to ability/ability_runtime/newwant/actsnewwantarelyhap/AppScope/app.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/AppScope/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwantarelyhap/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/newwant/actsnewwantarelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/newwant/actsnewwantarelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/BUILD.gn b/ability/ability_runtime/newwant/actsnewwantarelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/BUILD.gn rename to ability/ability_runtime/newwant/actsnewwantarelyhap/BUILD.gn diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/Test.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/Test.json rename to ability/ability_runtime/newwant/actsnewwantarelyhap/Test.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/module.json rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwantarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/newwant/actsnewwantarelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantarelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/newwant/actsnewwantarelyhap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/AppScope/app.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/AppScope/app.json rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/AppScope/app.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/AppScope/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/newwant/actsnewwantbrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/BUILD.gn b/ability/ability_runtime/newwant/actsnewwantbrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/BUILD.gn rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/BUILD.gn diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/Test.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/Test.json rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/Test.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/module.json rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/newwant/actsnewwantbrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/newwant/actsnewwantbrelyhap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/AppScope/app.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/AppScope/app.json rename to ability/ability_runtime/newwant/actsnewwantrelyhap/AppScope/app.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/AppScope/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwantrelyhap/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/newwant/actsnewwantrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/newwant/actsnewwantrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/BUILD.gn b/ability/ability_runtime/newwant/actsnewwantrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/BUILD.gn rename to ability/ability_runtime/newwant/actsnewwantrelyhap/BUILD.gn diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/Test.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a848aab9e28cd0abc12235a36d5d6ae7a39dae9 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,146 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' + +export default class SecondAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("ACTS_NewWant SecondAbility onCreate") + globalThis.abilityWant = want; + commonEvent.publish("onCreateSecond_To_Test_CommonEvent", () => { + console.log("ACTS_NewWant Publish CallBack onCreateSecond_To_Test_CommonEvent") + }); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_NewWant SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_NewWant SecondAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + + commonEvent.publish("onWindowStageCreateSecond_To_Test_CommonEvent", () => { + console.log("ACTS_NewWant Publish CallBack onWindowStageCreateSecond_To_Test_CommonEvent") + }); + } + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_NewWant SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + var connId; + console.log("ACTS_NewWant SecondAbility onForeground") + if (globalThis.abilityWant.action == 'startSingleton0400') + { + globalThis.abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.MainAbility", + action:"startStandard0400" + }, (error, data) => { + console.log('ACTS_NewWant SecondAbility onForeground - startAbility start standard: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + } + if (globalThis.abilityWant.action == 'startSingleton0300') + { + globalThis.abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.MainAbility", + action:"restartSingleton" + }, (error, data) => { + console.log('ACTS_NewWant SecondAbility onForeground - startAbility restart standard: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + } + if (globalThis.abilityWant.action == 'startHapA0500') { + globalThis.abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapb.MainAbility", + action: "restartHapB" + }, (error, data) => { + console.log('ACTS_NewWant SecondAbility onForeground - startAbility restart HapB: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + } + if (globalThis.abilityWant.action == 'startHapA0600') { + globalThis.abilityContext.startAbility({ + bundleName: "com.example.newwanthapa", + abilityName: "com.example.newwanthapc.MainAbility", + action: "restartHapC" + }, (error, data) => { + console.log('ACTS_NewWant SecondAbility onForeground - startAbility restart HapC: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + } + if (globalThis.abilityWant.action == 'startSecondAbility0700') { + globalThis.abilityContext.startAbility( + { + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.MainAbility", + action: "startMainAbility0700" + }, (error, data) => { + console.log('ACTS_NewWant SecondAbility onForeground - startAbility startMainAbility0700: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }); + } + if (globalThis.abilityWant.action == 'startSecondAbility0800') { + globalThis.abilityContext.startAbility( + { + bundleName: "com.example.newwanthapapi7", + abilityName: "com.example.newwanthapapi7.MainAbility", + action: "startapi70800" + }, (error, data) => { + console.log('ACTS_NewWant SecondAbility onForeground - startAbility startapi70800: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }); + } + commonEvent.publish("onForegroundSecond_To_Test_CommonEvent", () => { + console.log("ACTS_NewWant SecondAbility Publish CallBack onForegroundSecond_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("ACTS_NewWant SecondAbility onBackground") + } + + onNewWant(want) { + // Ability has brought to foreground when it already in foreground + console.log("ACTS_NewWant SecondAbility onNewWant") + globalThis.abilityWant = want; + console.log("ACTS_NewWant SecondAbility onNewWant deviceId :" + want.deviceId) + console.log("ACTS_NewWant SecondAbility onNewWant bundleName :" + want.bundleName) + console.log("ACTS_NewWant SecondAbility onNewWant abilityName :" + want.abilityName) + console.log("ACTS_NewWant SecondAbility onNewWant uri :" + want.uri) + console.log("ACTS_NewWant SecondAbility onNewWant type :" + want.type) + console.log("ACTS_NewWant SecondAbility onNewWant flags :" + want.flags) + console.log("ACTS_NewWant SecondAbility onNewWant action :" + want.action) + var publishData = { + data: want.action + } + commonEvent.publish("onNewWantSecond_To_Test_CommonEvent", publishData,() => { + console.log("ACTS_NewWant SecondAbility Publish CallBack onNewWantSecond_To_Test_CommonEvent") + }); + } +}; diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1c64a7122966536fc31b8745f021a08888f1052 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,54 @@ +/* + * 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility'; +import Want from '@ohos.application.Want'; +import rpc from "@ohos.rpc"; + +export default class ServiceAbility extends ServiceExtension { + onCreate(want: Want) { + globalThis.abilityWant = want; + console.log('ACTS_NewWant ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ACTS_NewWant ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + } + + onConnect(want) { + var connId; + console.log('ACTS_NewWant ServiceAbility onConnect, want:' + want.abilityName); + globalThis.extensionContext = this.context + if (globalThis.abilityWant.action == 'connectServiceAbility0700') { + console.log('ACTS_NewWant ServiceAbility onConnect, action:' + globalThis.abilityWant.action); + this.context.startAbility( + { + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.SecondAbility", + action: "restartSecondAbility0700" + }, + ) + } + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('ACTS_NewWant ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ACTS_NewWant ServiceAbility onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..edba4605f8e396a9e91263650657acb7c1597a9d --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,38 @@ +/* + * 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" +//import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear() { + console.info("start run testcase!!!!") + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('NewWantHapA MainAbility') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/module.json rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwantrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/newwant/actsnewwantrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/newwant/actsnewwantrelyhap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/AppScope/app.json b/ability/ability_runtime/newwant/actsnewwanttest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/AppScope/app.json rename to ability/ability_runtime/newwant/actsnewwanttest/AppScope/app.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/AppScope/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwanttest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwanttest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/newwant/actsnewwanttest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/newwant/actsnewwanttest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/BUILD.gn b/ability/ability_runtime/newwant/actsnewwanttest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/BUILD.gn rename to ability/ability_runtime/newwant/actsnewwanttest/BUILD.gn diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/Test.json b/ability/ability_runtime/newwant/actsnewwanttest/Test.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/Test.json rename to ability/ability_runtime/newwant/actsnewwanttest/Test.json diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..6837617a9924633681df2961ba7c9a319bf431d8 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,24 @@ +/* + * 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..dedc8cbede8045f84aef2a9d49b44b7291709894 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,67 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0df04ae14c2b10b2d4453c340cb5ab6a02881245 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,653 @@ +/* + * 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 "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +import missionManager from '@ohos.application.missionManager' +import appManager from '@ohos.application.appManager' + +const MAX_MISSION_NUM = 1024; +var subscriberInfo = { + events: ['onCreateMain_To_Test_CommonEvent', + 'onWindowStageCreateMain_To_Test_CommonEvent', + 'onForegroundMain_To_Test_CommonEvent', + 'onNewWantMain_To_Test_CommonEvent', + 'onCreateSecond_To_Test_CommonEvent', + 'onWindowStageCreateSecond_To_Test_CommonEvent', + 'onForegroundSecond_To_Test_CommonEvent', + 'onNewWantSecond_To_Test_CommonEvent', + ], +}; + +function getMissionId() { + return new Promise(async (resolve, reject) => { + var missionId = -1; + var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM); + console.log('======>ACTS_NewWant_Test getMissionId missionInfos<=======' + missionInfos); + for (let i = 0; i < missionInfos.length; i++) { + console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i])) + if ((missionInfos[i].want.abilityName == "com.example.newwanttest.MainAbility") && + (missionInfos[i].runningState == 0)) { + missionId = missionInfos[i].missionId; + break; + } + } + console.log('======>ACTS_NewWant_Test getMissionId resolve missionId<=======' + missionId); + resolve(missionId); + }) +} + +export default function abilityTest(abilityContext) { + describe('ActsNewWantTest', function () { + + afterEach(async (done) => { + + var testMissionId; + testMissionId = await getMissionId(); + console.log('======>ACTS_NewWant_Test afterEach test missionId<=======' + testMissionId); + await missionManager.moveMissionToFront(testMissionId); + console.log('======>ACTS_NewWant_Test afterEach test move<======='); + + await appManager.killProcessesByBundleName("com.example.newwanthapapi7"); + await appManager.killProcessesByBundleName("com.example.newwanthapa"); + await appManager.killProcessesByBundleName("com.example.newwanthap"); + + done(); + }) + + /** + * @tc.number: ACTS_NewWant_Test_0100 + * @tc.name: Starting standard Ability for the first time does not trigger onNewWant. + * @tc.desc: Starting standard Ability for the first time does not trigger onNewWant. + */ + it('ACTS_NewWant_Test_0100', 0, async function (done) { + console.log("ACTS_NewWant_Test_0100 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.MainAbility" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0100 - startAbility start standard: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0100====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0100====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0100====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateMain_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateMain_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundMain_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantMain_To_Test_CommonEvent': + flagOnNewWant++; + break; + } + console.debug("ACTS_NewWant_Test_0100====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0100====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0100====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0100====>flagOnNewWant:====>" + + flagOnNewWant) + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 1 && flagOnNewWant == 0) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(1); + expect(flagOnNewWant).assertEqual(0); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0100====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0200 + * @tc.name: Starting singleton Ability for the first time does not trigger onNewWant. + * @tc.desc: Starting singleton Ability for the first time does not trigger onNewWant. + */ + it('ACTS_NewWant_Test_0200', 0, async function (done) { + console.log("ACTS_NewWant_Test_0200 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.SecondAbility" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0200 - startAbility start singleton: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0200====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0200====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0200====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateSecond_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateSecond_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundSecond_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantSecond_To_Test_CommonEvent': + flagOnNewWant++; + break; + } + console.debug("ACTS_NewWant_Test_0200====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0200====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0200====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0200====>flagOnNewWant:====>" + + flagOnNewWant) + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 1 && flagOnNewWant == 0) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(1); + expect(flagOnNewWant).assertEqual(0); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0200====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0300 + * @tc.name: Starting standard ability the second time does not trigger onNewWant. + * @tc.desc: Starting standard ability the second time does not trigger onNewWant. + */ + it('ACTS_NewWant_Test_0300', 0, async function (done) { + console.log("ACTS_NewWant_Test_0300 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.MainAbility", + action: "startStandard0300" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0300 - startAbility start standard: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0300====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0300====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0300====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateMain_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateMain_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundMain_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantMain_To_Test_CommonEvent': + flagOnNewWant++; + break; + } + console.debug("ACTS_NewWant_Test_0300====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0300====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0300====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0300====>flagOnNewWant:====>" + + flagOnNewWant) + + if (flagOnCreate == 2 && flagOnWindowStageCreate == 2 + && flagOnForeground == 2 && flagOnNewWant == 0) { + expect(flagOnCreate).assertEqual(2); + expect(flagOnWindowStageCreate).assertEqual(2); + expect(flagOnForeground).assertEqual(2); + expect(flagOnNewWant).assertEqual(0); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0300====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0400 + * @tc.name: Two abilities of the same hap + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_NewWant_Test_0400', 0, async function (done) { + console.log("ACTS_NewWant_Test_0400 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.SecondAbility", + action: "startSingleton0400" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0400 - startAbility start singleton: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0400====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0400====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0400====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateSecond_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateSecond_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundSecond_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantSecond_To_Test_CommonEvent': + flagOnNewWant++; + expect(data.data).assertEqual('restartSingleton'); + break; + } + console.debug("ACTS_NewWant_Test_0400====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0400====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0400====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0400====>flagOnNewWant:====>" + + flagOnNewWant) + + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 2 && flagOnNewWant == 1) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(2); + expect(flagOnNewWant).assertEqual(1); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0400====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0500 + * @tc.name: Two haps of the same app + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_NewWant_Test_0500', 0, async function (done) { + console.log("ACTS_NewWant_Test_0500 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapb.MainAbility", + action: "startHapB" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0500 - startAbility start HapB: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0500====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0500====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0500====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateMain_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateMain_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundMain_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantMain_To_Test_CommonEvent': + flagOnNewWant++; + expect(data.data).assertEqual('restartHapB'); + break; + } + console.debug("ACTS_NewWant_Test_0500====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0500====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0500====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0500====>flagOnNewWant:====>" + + flagOnNewWant) + + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 2 && flagOnNewWant == 1) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(2); + expect(flagOnNewWant).assertEqual(1); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0500====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0600 + * @tc.name: Cross-application + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_NewWant_Test_0600', 0, async function (done) { + console.log("ACTS_NewWant_Test_0600 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthapa", + abilityName: "com.example.newwanthapc.MainAbility", + action: "startHapC" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0600 - startAbility start HapC: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0600====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0600====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0600====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateMain_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateMain_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundMain_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantMain_To_Test_CommonEvent': + flagOnNewWant++; + expect(data.data).assertEqual('restartHapC'); + break; + } + console.debug("ACTS_NewWant_Test_0600====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0600====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0600====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0600====>flagOnNewWant:====>" + + flagOnNewWant) + + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 2 && flagOnNewWant == 1) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(2); + expect(flagOnNewWant).assertEqual(1); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0600====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0700 + * @tc.name: Service ability + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_NewWant_Test_0700', 0, async function (done) { + console.log("ACTS_NewWant_Test_0700 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.SecondAbility", + action: "startSecondAbility0700" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0700 - startAbility start SecondAbility: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0700====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0700====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0700====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateSecond_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateSecond_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundSecond_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantSecond_To_Test_CommonEvent': + flagOnNewWant++; + expect(data.data).assertEqual('restartSecondAbility0700'); + break; + } + console.debug("ACTS_NewWant_Test_0700====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0700====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0700====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0700====>flagOnNewWant:====>" + + flagOnNewWant) + + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 2 && flagOnNewWant == 1) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(2); + expect(flagOnNewWant).assertEqual(1); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0700====>UnSubscribe CallBack====>"); + done(); + } + }) + + /** + * @tc.number: ACTS_NewWant_Test_0800 + * @tc.name: API8 startup API7 + * @tc.desc: Starting singleton ability the second time does triggers onNewWant. + */ + it('ACTS_NewWant_Test_0800', 0, async function (done) { + console.log("ACTS_NewWant_Test_0800 --- start") + var Subscriber; + var flagOnCreate = 0; + var flagOnWindowStageCreate = 0; + var flagOnForeground = 0; + var flagOnNewWant = 0; + + abilityContext.startAbility({ + bundleName: "com.example.newwanthap", + abilityName: "com.example.newwanthapa.SecondAbility", + action: "startSecondAbility0800" + }, (error, data) => { + console.log('ACTS_NewWant_Test_0800 - startAbility start SecondAbility: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }) + + commonEvent.createSubscriber(subscriberInfo).then(async (data) => { + console.debug("ACTS_NewWant_Test_0800====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function SubscribeCallBack(err, data) { + + console.debug("ACTS_NewWant_Test_0800====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + console.debug("ACTS_NewWant_Test_0800====>Subscribe CallBack data.event:====>" + + JSON.stringify(data.event)); + switch (data.event) { + case 'onCreateSecond_To_Test_CommonEvent': + flagOnCreate++; + break; + case 'onWindowStageCreateSecond_To_Test_CommonEvent': + flagOnWindowStageCreate++; + break; + case 'onForegroundSecond_To_Test_CommonEvent': + flagOnForeground++; + break; + case 'onNewWantSecond_To_Test_CommonEvent': + flagOnNewWant++; + expect(data.data).assertEqual('restartSecondAbility0800'); + break; + } + console.debug("ACTS_NewWant_Test_0800====>flagOnCreate:====>" + + flagOnCreate) + console.debug("ACTS_NewWant_Test_0800====>flagOnWindowStageCreate:====>" + + flagOnWindowStageCreate) + console.debug("ACTS_NewWant_Test_0800====>flagOnForeground:====>" + + flagOnForeground) + console.debug("ACTS_NewWant_Test_0800====>flagOnNewWant:====>" + + flagOnNewWant) + + if (flagOnCreate == 1 && flagOnWindowStageCreate == 1 + && flagOnForeground == 2 && flagOnNewWant == 1) { + expect(flagOnCreate).assertEqual(1); + expect(flagOnWindowStageCreate).assertEqual(1); + expect(flagOnForeground).assertEqual(2); + expect(flagOnNewWant).assertEqual(1); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + function UnSubscribeCallback() { + console.debug("ACTS_NewWant_Test_0800====>UnSubscribe CallBack====>"); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecda46da39a99063bac759287cbb994c0cb13b1b --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,23 @@ +/* + * 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 abilityTest from './Ability.test.ets' + + +export default function testsuite(context) { + + abilityTest(context) + +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/module.json rename to ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/newwant/actsnewwanttest/signature/openharmony_sx.p7b b/ability/ability_runtime/newwant/actsnewwanttest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwanttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/newwant/actsnewwanttest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/non_concurrent/BUILD.gn b/ability/ability_runtime/non_concurrent/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/BUILD.gn rename to ability/ability_runtime/non_concurrent/BUILD.gn diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/app.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..cf576dc15f5dd16fe89b1e496d5569ba70d2f753 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsabilitypermissiontest", + "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/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/resources/base/element/string.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/BUILD.gn b/ability/ability_runtime/non_concurrent/acts_systemappa_test/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/BUILD.gn rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/BUILD.gn diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/Test.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f568cdbf05e4fd33f601eb344468e3f022ffce15 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/Test.json @@ -0,0 +1,62 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsabilitypermissiontest", + "shell-timeout": "300000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSystemAppATest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSystemAppATest.hap->/system/app/ActsSystemAppATest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm switch -i 101" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSystemAppOneRelyHap.hap->/system/app/ActsSystemAppOneRelyHap.hap" + ] + }, + { + "test-file-name": [ + "ActsSystemAppOneRelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d88d073b2a98fb0a5c339bb3152c5f4ee7405511 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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; + } + + 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") + globalThis.abilityContext = this.context + 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/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..d96a855d995c637d4973a9890c2c06b01cce2e9b --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,57 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne1() { + console.debug("====>Publish CallBack ACTS_ThirdPartyAbilityPermission_0100_CommonEvent====>"); + globalThis.ability2Context.terminateSelf(); + console.debug("====>close this context====>") +} + + +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility2 onCreate") + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index/index2", null) + globalThis.ability2Context = this.context; + commonEvent.publish("ACTS_AbilityPermission_0100_Start_CommonEvent", PublishCallBackOne1); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility2 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility2 onBackground") + } +}; diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/ServiceAbility/service.ts diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9684c6481bd50765a73977b94eb1f592953cfc83 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,50 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index2.ets b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index2.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index2.ets rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/index/index2.ets diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/AbilityPermission.test.ets b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/AbilityPermission.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1a70fef856515e055f1fc2fc4a45e73755a42ee --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/AbilityPermission.test.ets @@ -0,0 +1,274 @@ +/* + * 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. + */ +// @ts-nocheck +import osaccount from '@ohos.account.osaccount' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonEvent' +var AbilityPermission1 = { + events: ["ACTS_AbilityPermission_0100_Start_CommonEvent"] +} +var AbilityPermission3 = { + events: ["ACTS_AbilityPermission_0300_Start_CommonEvent"] +} +var AbilityPermission4 = { + events: ["ACTS_AbilityPermission_0400_Start_CommonEvent"] +} +var AbilityPermission6 = { + events: ["ACTS_AbilityPermission_0600_Start_CommonEvent"] +} +const START_ABILITY_TIMEOUT = 3000; +export default function abilityPermissionTest(abilityContext) { + describe('ActsAbilityPermissionTest', function () { + var osAccountManager = osaccount.getAccountManager(); + var userA; + var userB; + beforeAll(async function(done){ + osAccountManager.getOsAccountLocalIdFromProcess().then((data)=>{ + userA = data + userB=userA+1 + console.log("userA=====>"+userA) + done() + }); + + }) + afterAll(async function(done){ + await osAccountManager.removeOsAccount(userB, (err)=>{ + console.debug("====>remove localId: " + userB + " err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AbilityPermission_0100 + * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start + * @tc.desc: Start an ability that belongs to the current user with the current user + */ + it('ACTS_AbilityPermission_0100', 0, async function (done) { + console.log("ACTS_AbilityPermission_0100====>callback start====>") + var Subscriber; + var flag = true; + + function SubscribeCallBack(err, data) { + console.debug("ACTS_AbilityPermission_0100====>Subscribe CallBack data:====>" + JSON.stringify(data)); + expect(data.event == 'ACTS_AbilityPermission_0100_Start_CommonEvent').assertTrue() + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(AbilityPermission1).then(async (data) => { + console.debug("ACTS_AbilityPermission_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbility_100====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsabilitypermissiontest', + abilityName: 'com.example.actsabilitypermissiontest.MainAbility2' + }, userA, () => { + console.debug("====>startAbility end_100====>"); + }) + }) + + function UnSubscribeCallback() { + flag = false + console.debug("ACTS_AbilityPermission_0100====>UnSubscribe CallBack====>"+flag); + done(); + } + setTimeout(()=>{ + if (flag == true) { + expect().assertFail(); + console.debug('in ACTS_AbilityPermission_0100====>timeout====>'+flag); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + console.debug('ACTS_AbilityPermission_0100====>timeout====>'); + }, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number: ACTS_AbilityPermission_0300 + * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start + * @tc.desc: Start an ability under user U101 with the current user + */ + it('ACTS_AbilityPermission_0300', 0, async function (done) { + console.log("ACTS_AbilityPermission_0300====>callback start====>") + var Subscriber + var flag = 0; + console.debug("====>get AccountManager finish===="); + + function SubscribeCallBack(err, data) { + console.debug("ACTS_AbilityPermission_0300====>Subscribe CallBack data:====>" + JSON.stringify(data)); + expect(data.event == 'ACTS_AbilityPermission_0300_Start_CommonEvent').assertTrue() + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + commonEvent.createSubscriber(AbilityPermission3).then(async (data) => { + console.debug("ACTS_AbilityPermission_0300====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbility_0300====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actssystemappuonehundredonerelytest', + abilityName: 'com.example.actssystemappuonehundredonerelytest.MainAbility' + }, userA ).then().catch((err) => { + console.debug("ACTS_AbilityPermission_0300====>" + err) + + console.debug("====>startAbility end_0300====>"); + }) + }) + function UnSubscribeCallback() { + if(flag == 0) { + expect().assertFail(); + } + console.debug("ACTS_AbilityPermission_0300====>UnSubscribe CallBack====>"); + done(); + } + function timeout() { + console.debug('ACTS_AbilityPermission_0300====>timeout====>'); + if(flag == 0){ + flag = 1; + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number: ACTS_AbilityPermission_0400 + * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start + * @tc.desc: Bind an Ability to which you belong with the current user + */ + it('ACTS_AbilityPermission_0400', 0, async function (done) { + console.log("ACTS_AbilityPermission_0400====>callback start====>") + let Subscriber + var flag = true + + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_AbilityPermission_0400_Start_CommonEvent").assertTrue(); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(globalThis.number).then((data) => { + console.debug("====>data is====>" + JSON.stringify(data)); + }) + console.log('====>disconnectAbility finish'); + } + + function onConnectCallback(element, remote) { + console.log('ACTS_AbilityPermission_0400_Start_CommonEvent onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_AbilityPermission_0400_Start_CommonEvent onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_AbilityPermission_0400_Start_CommonEvent - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + commonEvent.createSubscriber(AbilityPermission4).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0400start connectAbility====>"); + globalThis.number = await abilityContext.connectAbilityWithAccount( + { + bundleName: 'com.example.actsabilitypermissiontest', + abilityName: 'com.example.actsabilitypermissiontest.ServiceAbility', + action: "StartAbilityPromise" + }, userA, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + done() + } + + function timeout() { + console.debug('in ACTS_AbilityPermission_0400_Start_CommonEvent timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_AbilityPermission_0400_Start_CommonEvent - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number: ACTS_AbilityPermission_0600 + * @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start + * @tc.desc: Bind a U101 Ability with the current user + */ + it('ACTS_AbilityPermission_0600', 0, async function (done) { + console.log("ACTS_AbilityPermission_0600====>callback start====>") + let Subscriber + let connId + function onConnectCallbackC(element, remote) { + console.log('ACTS_AbilityPermission_0600_Start_CommonEvent onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_AbilityPermission_0600_Start_CommonEvent onConnectCallback====> remote=' + JSON.stringify(remote)); + expect().assertFail(); + } + function onDisconnectCallbackC(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + function onFailedCallbackC(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + function SubscribeCallBackF(err, data) { + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + } + function UnSubscribeCallbackF() { + console.debug("====>UnSubscribeCallback====>"); + } + commonEvent.createSubscriber(AbilityPermission6).then(async (data) => { + console.debug("====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBackF); + }) + console.debug("====>0600start connectAbility====>"); + connId = await abilityContext.connectAbilityWithAccount( + { + bundleName: 'com.example.actssystemappuonehundredonerelytest', + abilityName: 'com.example.actssystemappuonehundredonerelytest.ServiceAbility', + action: "StartAbilityPromise" + }, userA, { + onConnect: onConnectCallbackC, + onDisconnect: onDisconnectCallbackC, + onFailed: onFailedCallbackC + }) + console.debug("====>number is====>" + JSON.stringify(connId)); + setTimeout(() =>{ + console.debug('in ACTS_AbilityPermission_0600_Start_CommonEvent timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallbackF) + done() + }, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..998089c74699eb9ca50ec4180bdf675adadf6ad0 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityPermissionText from './AbilityPermission.test.ets' + +export default function testsuite(context) { + abilityPermissionText(context) +} \ No newline at end of file diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..c8dcd29a0f33491db39c44ba7f883c19cc8d8434 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json @@ -0,0 +1,121 @@ +{ + "module": { + "name": "com.example.actsabilitypermissiontest", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsabilitypermissiontest.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" + ] + } + ] + }, + { + "name": "com.example.actsabilitypermissiontest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsabilitypermissiontest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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" + }, + { + "name":"ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.INTERACT_ACROSS)LOCAL_ACCOUNTS_EXTENSION", + "reason":"need use ohos.permission.INTERACT_ACROSS)LOCAL_ACCOUNTS_EXTENSION" + }, + { + "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + } + ] + } +} diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/newwant/actsnewwantapi7relyhap/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/signature/openharmony_sx.p7b b/ability/ability_runtime/non_concurrent/acts_systemappa_test/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/signature/openharmony_sx.p7b rename to ability/ability_runtime/non_concurrent/acts_systemappa_test/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/app.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..22ec98ecb01a4963ad71d567ca114da5b95b328a --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.acts.pmvendorappa", + "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/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/element/string.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/BUILD.gn b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5b8bb03ca69ab8afec9ec4cde660c88f405b23c4 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsSystemAppOneRelyHap") { + hap_profile = "entry/src/main/module.json" + hap_name = "ActsSystemAppOneRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":acts_systemappone_rely_test_js_assets", + ":acts_systemappone_rely_test_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("acts_systemappone_rely_test_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("acts_systemappone_rely_test_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("acts_systemappone_rely_test_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":acts_systemappone_rely_test_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/Test.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..7335dbf497d3066e1a6d7fb6a9576e23a7e41f58 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent' +function PublishCallBackOne3() { + console.debug("====>Publish CallBack ACTS_StartAbility_0300_CommonEvent====>"); + setTimeout(globalThis.abilityContext.terminateSelfWithResult(()=>{ + console.debug("====>terminateSelfWithResult succese====>") + }),1000) +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context + commonEvent.publish("ACTS_AbilityPermission_0300_Start_CommonEvent", PublishCallBackOne3); + 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/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/ServiceAbility.ts diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/ServiceAbility/service.ts diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..620defb9517f2064e42340b499e501a5bb0495b6 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json @@ -0,0 +1,48 @@ +{ + "module": { + "name": "com.example.actssystemappuonehundredonerelytest", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actssystemappuonehundredonerelytest.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actssystemappuonehundredonerelytest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ] + } +} diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappa_test/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/signature/openharmony_sx.p7b b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/signature/openharmony_sx.p7b rename to ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/processmultiinstance/BUILD.gn b/ability/ability_runtime/processmultiinstance/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/BUILD.gn rename to ability/ability_runtime/processmultiinstance/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..26ab7bd17db8b0db0058d4be980a5659407719e1 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapa", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f770af1c85ed95abcf5c99b9190262595c6ab6f4 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,56 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("ACTS_Process_MultiInstance_HapAA MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_Process_MultiInstance_HapAA MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_Process_MultiInstance_HapAA MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + + commonEvent.publish("HapAA_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapAA Publish CallBack HapAA_To_Test_CommonEvent") + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_Process_MultiInstance_HapAA MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("ACTS_Process_MultiInstance_HapAA MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("ACTS_Process_MultiInstance_HapAA MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..1089647e9fb653e300e0171eec1bfeb6f0f948bc --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "com.example.multiinstancehapaa", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapaa.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/non_concurrent/acts_systemappone_rely_test/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..26ab7bd17db8b0db0058d4be980a5659407719e1 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapa", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef8a0e1a53037891dabcbbc75cc237963b04493c --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,56 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("ACTS_Process_MultiInstance_HapAB MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_Process_MultiInstance_HapAB MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_Process_MultiInstance_HapAB MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + + commonEvent.publish("HapAB_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapAB Publish CallBack HapAB_To_Test_CommonEvent") + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_Process_MultiInstance_HapAB MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("ACTS_Process_MultiInstance_HapAB MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("ACTS_Process_MultiInstance_HapAB MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7e3387923982544d81cdb08dd8d4b42847cb1abc --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "com.example.multiinstancehapab", + "process": "com.example.multiinstancehapb", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapab.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d307b6ffff679e2ac53d75cf72ae7d7e0554748f --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapb", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f1c52538a6627a9e63b83c92f564f8b357471fc1 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +let connectionId = -1; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context; + + let context = this.context; + + 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("ACTS_Process_MultiInstance_HapBA MainAbility onForeground") + commonEvent.publish("HapBA_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapBA Publish CallBack HapBA_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..73bdcb7f6e2337ee4f47bb0bf8e68b4b9e70d6cf --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "com.example.multiinstancehapba", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapba.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d307b6ffff679e2ac53d75cf72ae7d7e0554748f --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapb", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..fdd62659d44b0910d56b928b66a8a585923277e1 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +let connectionId = -1; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context; + + let context = this.context; + + 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("ACTS_Process_MultiInstance_HapBB MainAbility onForeground") + commonEvent.publish("HapBB_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapBB Publish CallBack HapBB_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9d46fa80fb140233ed4123ccac174955be6e7c18 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "com.example.multiinstancehapbb", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapbb.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d307b6ffff679e2ac53d75cf72ae7d7e0554748f --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapb", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..6782e58206b4a6072aefa655c98b2a7b14d67f98 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +let connectionId = -1; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context; + + let context = this.context; + + 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("ACTS_Process_MultiInstance_HapBC MainAbility onForeground") + commonEvent.publish("HapBC_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapBC Publish CallBack HapBC_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e14379235d134cb582c13ee15d79b7c8a4ddd7c1 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "com.example.multiinstancehapbc", + "process": "com.example.multiinstancehapc", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapbc.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d307b6ffff679e2ac53d75cf72ae7d7e0554748f --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapb", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf03788100c2842c954ce18aeb51c528a4524b05 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +let connectionId = -1; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context; + + let context = this.context; + + 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("ACTS_Process_MultiInstance_HapBD MainAbility onForeground") + commonEvent.publish("HapBD_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapBD Publish CallBack HapBD_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..ead67d4bb61501de77df770112d8cf5eb9c1e4e9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "com.example.multiinstancehapbd", + "process": "com.example.multiinstancehapc", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapbd.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d307b6ffff679e2ac53d75cf72ae7d7e0554748f --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapb", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b043dc469da8c68c3988719ae1fb29c6a04a4c2b --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +let connectionId = -1; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context; + + let context = this.context; + + 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("ACTS_Process_MultiInstance_HapBE MainAbility onForeground") + commonEvent.publish("HapBE_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapBE Publish CallBack HapBE_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..527f67cd10dce15b822d892de226fe979b6a20c6 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "com.example.multiinstancehapbe", + "process": "com.example.multiinstancehapa", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapbe.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d307b6ffff679e2ac53d75cf72ae7d7e0554748f --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.multiinstancehapb", + "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/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/BUILD.gn diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d3d245f965fff5b6efb6b0fea3a37bf3bf1831e --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* +* 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' +import commonEvent from '@ohos.commonEvent' + +let connectionId = -1; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + 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") + globalThis.abilityContext = this.context; + + let context = this.context; + + 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("ACTS_Process_MultiInstance_HapBF MainAbility onForeground") + commonEvent.publish("HapBF_To_Test_CommonEvent", () => { + console.log("ACTS_Process_MultiInstance_HapBF Publish CallBack HapBF_To_Test_CommonEvent") + }); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d9eb79683ad4de3182dbc17e6ff3faa1a1205042 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "com.example.multiinstancehapbf", + "process": "com.example.multiinstancehapb", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.multiinstancehapbf.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" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/app.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/app.json similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/app.json rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/app.json diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/BUILD.gn b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/BUILD.gn rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/BUILD.gn diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/Test.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/Test.json similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/Test.json rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/Test.json diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/List.test.ets similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/element/string.json similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancetest/signature/openharmony_sx.p7b rename to ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/stage/BUILD.gn b/ability/ability_runtime/stage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f05ebb7ec909581521e548a1d21075f6dc1d3b7f --- /dev/null +++ b/ability/ability_runtime/stage/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("stage") { + testonly = true + if (is_standard_system) { + deps = [ + "actslifecyclemultihap2test:ActsLifecycleMultiHap2Test", + "actslifecyclemultihap3test:ActsLifecycleMultiHap3Test", + "actslifecyclemultihaptest:ActsLifecycleMultiHapTest", + "actslifecyclesinglehaptest:ActsLifecycleSingleHapTest", + ] + } +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/app.json b/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c5c4b86ccc5929879b6058354d81fc19477a7807 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.lifecycletest", + "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 + } + } +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d1bcc101e5ae9fc38bc49a6423ceb266bf0d8e37 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"LifecycleHap2Test" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap2test/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/stage/actslifecyclemultihap2test/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/BUILD.gn b/ability/ability_runtime/stage/actslifecyclemultihap2test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..50af07476ed56c79d0e342f8be00f78cd1675ffd --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/BUILD.gn @@ -0,0 +1,40 @@ +# 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("ActsLifecycleMultiHap2Test") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actslifecyclemultihap2test_js_assets", + ":actslifecyclemultihap2test_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsLifecycleMultiHap2Test" +} + +ohos_app_scope("actslifecyclemultihap2test_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actslifecyclemultihap2test_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actslifecyclemultihap2test_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actslifecyclemultihap2test_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/Test.json b/ability/ability_runtime/stage/actslifecyclemultihap2test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f90168bef2aac9d93ee6caba4da1165cff4f8c95 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.lifecycletest", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsLifecycleMultiHap2Test.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Application/AbilityStage.ts diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..bec960b3c3275cbf15637a63f47fc3a9a5f30d66 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts @@ -0,0 +1,49 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility1 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility1 onCreate") + globalThis.abilityWant = want; + + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility1 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility1_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts new file mode 100644 index 0000000000000000000000000000000000000000..347dedffc1ddaf97c709ee1433f05b90f07c9afe --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts @@ -0,0 +1,49 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility10 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility10 onCreate") + globalThis.abilityWant = want; + + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility10 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility10 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility10_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility10 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility10 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility10 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..a37bf2c0a52940fe6d5b4b71535d0d3ac30e07d1 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility2 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility2 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility2_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility2 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..a854922b40aef3959434c8a0409a94691b97b51c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility3 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility3 onCreate") + globalThis.abilityWant = want; + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility3 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility3 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility3 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility3_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility3 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6f878c71dddaa1fec96f1d41280867a088ba214 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility4 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility4 onCreate") + globalThis.abilityWant = want; + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility4 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility4 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility4 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility4 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility4_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility4 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility4 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility4 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts new file mode 100644 index 0000000000000000000000000000000000000000..63bb901744c0a517b14cca742493d133ac897346 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility5 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility5 onCreate") + globalThis.abilityWant = want; + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility5 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility5 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility5 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility5 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility5_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility5 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility5 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility5 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts new file mode 100644 index 0000000000000000000000000000000000000000..37b0c2335f46b81a4c4848699d33f3304db1aa58 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts @@ -0,0 +1,55 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility6 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility6 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility6 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility6 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility6_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility6 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility6 onForeground") + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility6 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility6 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility6 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6db343ce1fe22035220b2980b39b6df4c5395ea --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility7 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility7 onCreate") + globalThis.abilityWant = want; + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility7 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility7 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility7 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility7 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility7_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility7 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility7 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility7 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts new file mode 100644 index 0000000000000000000000000000000000000000..65a9a637364fb75bd7207ad6f5ecac78935a8b0f --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility8 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility8 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility8 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility8 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility8_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resourcesl + console.log("[Demo] Hap2MainAbility8 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility8 onForeground") + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility8 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility8 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 500) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility8 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts new file mode 100644 index 0000000000000000000000000000000000000000..63a663c393e74ecf5ce4e89c307580958ff71cbe --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap2MainAbility9 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap2MainAbility9 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] Hap2MainAbility9 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap2MainAbility9 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap2MainAbility9_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap2MainAbility9 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap2MainAbility9 onForeground") + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility9 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap2MainAbility9 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 500) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap2MainAbility9 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc63965cb3ebacff2324b8b95d9803f796dae7d4 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility10_pages { + @State message: string = 'Hap2MainAbility10' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b6d6f9a59127258197f4ea778a2c2c809014e44 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility1_pages { + @State message: string = 'Hap2MainAbility1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..7992f9f03a75c98af049a301f06632be24a14f9c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility2_pages { + @State message: string = 'Hap2MainAbility2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..dab4f096fc4135638b40c1bc83267ed585ff0980 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility3_pages { + @State message: string = 'Hap2MainAbility3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..d19f359d5741096a31c29f170fce8f5a28952a00 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility4_pages { + @State message: string = 'Hap2MainAbility4' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca736ab2481b519ca10d8ca223965aec48b63452 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility5_pages { + @State message: string = 'Hap2MainAbility5' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..770bf42ca0ecf535c0104fb79e1144c05f268c98 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility6_pages { + @State message: string = 'Hap2MainAbility6' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..debef0b416a44ed4c784f916902f4c86889d7390 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility7_pages { + @State message: string = 'Hap2MainAbility7' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..657a45041d2499b44d7257797e3b51f5942970aa --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility8_pages { + @State message: string = 'Hap2MainAbility8' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ecfb15ced8d5d6699059cf32f801ec938af3d94 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap2MainAbility9_pages { + @State message: string = 'Hap2MainAbility9' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f1792371629b9a9fec9279715236ac9ba85fe8a --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/module.json @@ -0,0 +1,121 @@ +{ + "module": { + "name": "hap2", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:hap2_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.lifecycletest.Hap2MainAbility1", + "srcEntrance": "./ets/Hap2MainAbility1/Hap2MainAbility1.ts", + "description": "$string:Hap2MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility1_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }, + { + "name": "Hap2MainAbility2", + "srcEntrance": "./ets/Hap2MainAbility2/Hap2MainAbility2.ts", + "description": "$string:Hap2MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility2_label" + }, + { + "name": "Hap2MainAbility3", + "srcEntrance": "./ets/Hap2MainAbility3/Hap2MainAbility3.ts", + "description": "$string:Hap2MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility3_label" + }, + { + "name": "Hap2MainAbility4", + "srcEntrance": "./ets/Hap2MainAbility4/Hap2MainAbility4.ts", + "description": "$string:Hap2MainAbility4_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility4_label", + "launchType": "singleton" + }, + { + "name": "Hap2MainAbility5", + "srcEntrance": "./ets/Hap2MainAbility5/Hap2MainAbility5.ts", + "description": "$string:Hap2MainAbility5_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility5_label", + "launchType": "standard" + }, + { + "name": "Hap2MainAbility6", + "srcEntrance": "./ets/Hap2MainAbility6/Hap2MainAbility6.ts", + "description": "$string:Hap2MainAbility6_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility6_label" + }, + { + "name": "Hap2MainAbility7", + "srcEntrance": "./ets/Hap2MainAbility7/Hap2MainAbility7.ts", + "description": "$string:Hap2MainAbility7_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility7_label" + }, + { + "name": "Hap2MainAbility8", + "srcEntrance": "./ets/Hap2MainAbility8/Hap2MainAbility8.ts", + "description": "$string:Hap2MainAbility8_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility8_label" + }, + { + "name": "Hap2MainAbility9", + "srcEntrance": "./ets/Hap2MainAbility9/Hap2MainAbility9.ts", + "description": "$string:Hap2MainAbility9_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility9_label" + }, + { + "name": "Hap2MainAbility10", + "srcEntrance": "./ets/Hap2MainAbility10/Hap2MainAbility10.ts", + "description": "$string:Hap2MainAbility10_desc", + "icon": "$media:icon", + "label": "$string:Hap2MainAbility10_label" + }], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.MANAGE_MISSIONS" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f892fcdcbd0f813bdbf94c3811bc3def5cef5c84 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/element/string.json @@ -0,0 +1,120 @@ +{ + "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": "ActsLifecycleMultihapTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "hap2_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "Hap2MainAbility1_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility1_label", + "value": "label" + }, + { + "name": "Hap2MainAbility2_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility2_label", + "value": "label" + }, + { + "name": "Hap2MainAbility3_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility3_label", + "value": "label" + }, + { + "name": "Hap2MainAbility4_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility4_label", + "value": "label" + }, + { + "name": "Hap2MainAbility5_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility5_label", + "value": "label" + }, + { + "name": "Hap2MainAbility6_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility6_label", + "value": "label" + }, + { + "name": "Hap2MainAbility7_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility7_label", + "value": "label" + }, + { + "name": "Hap2MainAbility8_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility8_label", + "value": "label" + }, + { + "name": "Hap2MainAbility9_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility9_label", + "value": "label" + }, + { + "name": "Hap2MainAbility10_desc", + "value": "description" + }, + { + "name": "Hap2MainAbility10_label", + "value": "label" + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap2test/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/stage/actslifecyclemultihap2test/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap2test/signature/openharmony_sx.p7b b/ability/ability_runtime/stage/actslifecyclemultihap2test/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap2test/signature/openharmony_sx.p7b rename to ability/ability_runtime/stage/actslifecyclemultihap2test/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/app.json b/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c5c4b86ccc5929879b6058354d81fc19477a7807 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.lifecycletest", + "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 + } + } +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..40cc8793e9d4e8b6fe81de17af8dd8f445b69fa5 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"LifecycleHap3Test" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap3test/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/stage/actslifecyclemultihap3test/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/BUILD.gn b/ability/ability_runtime/stage/actslifecyclemultihap3test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d163f02cf004ae32bd99c93985da0189792b6bd3 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/BUILD.gn @@ -0,0 +1,40 @@ +# 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("ActsLifecycleMultiHap3Test") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actslifecyclemultihap3test_js_assets", + ":actslifecyclemultihap3test_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsLifecycleMultiHap3Test" +} + +ohos_app_scope("actslifecyclemultihap3test_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actslifecyclemultihap3test_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actslifecyclemultihap3test_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actslifecyclemultihap3test_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/Test.json b/ability/ability_runtime/stage/actslifecyclemultihap3test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9fe74e62191d4a0b87664e12d4401cccbb224b6d --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.lifecycletest", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsLifecycleMultiHap3Test.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Application/AbilityStage.ts diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..6cf700e0ba18c3f0c033b5626c9db3667fad1f8b --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts @@ -0,0 +1,49 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import Ability from '@ohos.application.Ability' + +export default class Hap3MainAbility1 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap3MainAbility1 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] Hap3MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap3MainAbility1 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap3MainAbility1_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap3MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap3MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap3MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..7162be27bd79381791b8e93fcc03af5ce629d8a5 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts @@ -0,0 +1,56 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap3MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap3MainAbility2 onCreate") + globalThis.abilityWant = want; + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap3MainAbility2 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap3MainAbility2 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap3MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap3MainAbility2 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap3MainAbility2_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap3MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap3MainAbility2 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap3MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..23852902afa38b65f8307ac90ab8f0fa36fe1ee4 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts @@ -0,0 +1,49 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import Ability from '@ohos.application.Ability' + +export default class Hap3MainAbility3 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap3MainAbility3 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] Hap3MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap3MainAbility3 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap3MainAbility3_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap3MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap3MainAbility3 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap3MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a9ce9f21e25baed9578ec89f3cad00c96279a7c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap3MainAbility1_pages { + @State message: string = 'Hap3MainAbility1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b9f5c0211d4d3ae96d36dc2aa858124019ac2cb --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap3MainAbility2_pages { + @State message: string = 'Hap3MainAbility2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..408e868c5237e0b134c9e5945a1d6024a8cea112 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets @@ -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. + */ +@Entry +@Component +struct Hap3MainAbility3_pages { + @State message: string = 'Hap3MainAbility3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..52dbb626fe4faa2b956997a1f1bcc7a086ef7819 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/module.json @@ -0,0 +1,70 @@ +{ + "module": { + "name": "hap3", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:hap3_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.lifecycletest.Hap3MainAbility1", + "srcEntrance": "./ets/Hap3MainAbility1/Hap3MainAbility1.ts", + "description": "$string:Hap3MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:Hap3MainAbility1_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }, + { + "name": "Hap3MainAbility2", + "srcEntrance": "./ets/Hap3MainAbility2/Hap3MainAbility2.ts", + "description": "$string:Hap3MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:Hap3MainAbility2_label" + }, + { + "name": "Hap3MainAbility3", + "srcEntrance": "./ets/Hap3MainAbility3/Hap3MainAbility3.ts", + "description": "$string:Hap3MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:Hap3MainAbility3_label" + }], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.MANAGE_MISSIONS" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..128e6511d057be0a20d26742d5efe00672c3817d --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/element/string.json @@ -0,0 +1,64 @@ +{ + "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": "ActsLifecycleMultihapTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "hap3_desc", + "value": "description" + }, + { + "name": "Hap3MainAbility1_desc", + "value": "description" + }, + { + "name": "Hap3MainAbility1_label", + "value": "label" + }, + { + "name": "Hap3MainAbility2_desc", + "value": "description" + }, + { + "name": "Hap3MainAbility2_label", + "value": "label" + }, + { + "name": "Hap3MainAbility3_desc", + "value": "description" + }, + { + "name": "Hap3MainAbility3_label", + "value": "label" + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap3test/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/stage/actslifecyclemultihap3test/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihap3test/signature/openharmony_sx.p7b b/ability/ability_runtime/stage/actslifecyclemultihap3test/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihap3test/signature/openharmony_sx.p7b rename to ability/ability_runtime/stage/actslifecyclemultihap3test/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/app.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c5c4b86ccc5929879b6058354d81fc19477a7807 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.lifecycletest", + "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 + } + } +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0d1f12ea9692aa14d5e6e140d74baa9b04c25352 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"LifecycleTest" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/stage/actslifecyclemultihaptest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/BUILD.gn b/ability/ability_runtime/stage/actslifecyclemultihaptest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fe3b14b8a877c468cda50b453ff6d62e8ce180b7 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/BUILD.gn @@ -0,0 +1,40 @@ +# 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("ActsLifecycleMultiHapTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actslifecyclemultihaptest_js_assets", + ":actslifecyclemultihaptest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsLifecycleMultiHapTest" +} + +ohos_app_scope("actslifecyclemultihaptest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actslifecyclemultihaptest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actslifecyclemultihaptest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actslifecyclemultihaptest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/Test.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d188df594316a2c2a9292e994b2b501f99971134 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.lifecycletest", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsLifecycleMultiHapTest.hap", + "ActsLifecycleMultiHap2Test.hap", + "ActsLifecycleMultiHap3Test.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9d13d23d175e4ba2b773b5b53226818f1b99c35 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context; + windowStage.setUIContent(this.context, "pages/MainAbility_pages", 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") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a351b4c5628eb9965f0bb219d14a71ad554009a --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,116 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility1 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility1 onCreate") + globalThis.abilityWant = want; + + var listKey = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityCreate") + listKey.push(abilityName +" onAbilityCreate"); + console.log("listKey is :" + listKey); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityWindowStageCreate") + listKey.push(abilityName +" onAbilityWindowStageCreate"); + console.log("listKey is :" + listKey); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityForeground") + listKey.push(abilityName +" onAbilityForeground"); + console.log("listKey is :" + listKey); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityBackground") + listKey.push(abilityName +" onAbilityBackground"); + console.log("listKey is :" + listKey); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityWindowStageDestroy") + listKey.push(abilityName +" onAbilityWindowStageDestroy"); + console.log("listKey is :" + listKey); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityDestroy") + listKey.push(abilityName +" onAbilityDestroy"); + console.log("listKey is :" + listKey); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityContinue") + listKey.push(abilityName +" onAbilityContinue"); + console.log("listKey is :" + listKey); + } + } + + globalThis.mainAbility1ListKey = listKey + var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); + globalThis.mainAbility1CallBackId = callBackId + setTimeout(() => { + console.log("listKey is :" + listKey); + console.log("callBackId is :" + callBackId); + this.context.getApplicationContext().unregisterAbilityLifecycleCallback (callBackId, (error, data)=> { + console.log("unRegisterAbilityLifecycleCallback err is :" + + JSON.stringify(error) + ",data is : " + JSON.stringify(data)) + }); + }, 4000) + + + setTimeout(()=>{ + this.context.terminateSelf().then((data) => { + console.log("[Demo] MainAbility1 terminateSelf windowStage data: " + JSON.stringify(data)) + }).catch((error) => { + console.log("[Demo] MainAbility1 terminateSelf windowStage error: " + JSON.stringify(error)) + }) + }, 3000) + } + + onDestroy() { + console.log("[Demo] MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility1 onWindowStageCreate") + globalThis.ability2Context = this.context; + windowStage.setUIContent(this.context, "pages/MainAbility1_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..133af9605cfccaf87ef76cbc21e23a5b77de5a37 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,104 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility2 onCreate") + globalThis.abilityWant = want; + + var listKey = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityCreate") + listKey.push(abilityName +" onAbilityCreate"); + console.log("listKey is :" + listKey); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityWindowStageCreate") + listKey.push(abilityName +" onAbilityWindowStageCreate"); + console.log("listKey is :" + listKey); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityForeground") + listKey.push(abilityName +" onAbilityForeground"); + console.log("listKey is :" + listKey); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityBackground") + listKey.push(abilityName +" onAbilityBackground"); + console.log("listKey is :" + listKey); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityWindowStageDestroy") + listKey.push(abilityName +" onAbilityWindowStageDestroy"); + console.log("listKey is :" + listKey); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityDestroy") + listKey.push(abilityName +" onAbilityDestroy"); + console.log("listKey is :" + listKey); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityContinue") + listKey.push(abilityName +" onAbilityContinue"); + console.log("listKey is :" + listKey); + } + } + + var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); + + setTimeout(() => { + globalThis.mainAbility2ListKey = listKey + globalThis.mainAbility2CallBackId = callBackId + console.log("listKey is :" + listKey); + console.log("callBackId is :" + callBackId); + }, 3000) + } + + onDestroy() { + console.log("[Demo] MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility2 onWindowStageCreate") + globalThis.ability3Context = this.context; + windowStage.setUIContent(this.context, "pages/MainAbility2_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility2 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8e4263aec6a543b718261bb2e0df46391535154 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,132 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import Ability from '@ohos.application.Ability' + +export default class MainAbility3 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility3 onCreate") + globalThis.abilityWant = want; + + var getauxMainAbilityContext = { + events: ["auxMainAbilityContext"] + } + + + var a; + function SubscribeCallBackContext(err, data) { + console.log(" Subscribe CallBack data:" + JSON.stringify(data)); + a = data.parameters; + if(data.event != ""){ + for (var key in data.parameters){ + console.log("data.parameters[key] is :" + data.parameters[key]) + } + } + } + + commonEvent.createSubscriber(getauxMainAbilityContext).then(async (data) => { + console.debug("====>Create Subscriber====>"); + var Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBackContext); + }); + + var listKey = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityCreate") + listKey.push(abilityName +" onAbilityCreate"); + console.log("listKey is :" + listKey); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityWindowStageCreate") + listKey.push(abilityName +" onAbilityWindowStageCreate"); + console.log("listKey is :" + listKey); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityForeground") + listKey.push(abilityName +" onAbilityForeground"); + console.log("listKey is :" + listKey); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityBackground") + listKey.push(abilityName +" onAbilityBackground"); + console.log("listKey is :" + listKey); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityWindowStageDestroy") + listKey.push(abilityName +" onAbilityWindowStageDestroy"); + console.log("listKey is :" + listKey); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityDestroy") + listKey.push(abilityName +" onAbilityDestroy"); + console.log("listKey is :" + listKey); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName +" onAbilityContinue") + listKey.push(abilityName +" onAbilityContinue"); + console.log("listKey is :" + listKey); + } + } + + setTimeout(() => { + console.log("mainAbility3ListKey a is : " + JSON.stringify(a)) + //TODO: + var callBackId = a.auxMainAbilityContext.getApplicationContext(). + registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("mainAbility3ListKey callBackId is : " + callBackId) + globalThis.mainAbility3ListKey = listKey + console.log("mainAbility3ListKey mainAbility3ListKey is : " + globalThis.mainAbility3ListKey) + globalThis.mainAbility3CallBackId = callBackId + console.log("mainAbility3ListKey listKey is :" + listKey); + console.log("mainAbility3ListKey globalThis.callBackId is :" + globalThis.callBackId); + }, 3000) + + } + + onDestroy() { + console.log("[Demo] MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility3 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/MainAbility3_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility3 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6a2a28cdade0b5b51d9fe8bebe1f9d62c3a9b71 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts @@ -0,0 +1,97 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility4 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility4 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility4 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility4 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/MainAbility4_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility4 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility4 onForeground") + + var listKey = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityCreate") + listKey.push(abilityName+" onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityWindowStageCreate") + listKey.push(abilityName+" onAbilityWindowStageCreate"); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityForeground") + listKey.push(abilityName+" onAbilityForeground"); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityBackground") + listKey.push(abilityName+" onAbilityBackground"); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityWindowStageDestroy") + listKey.push(abilityName+" onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityDestroy") + listKey.push(abilityName+" onAbilityDestroy"); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityContinue") + listKey.push(abilityName+" onAbilityContinue"); + } + } + var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); + globalThis.abilityContext111 = this.context; + console.log("callBackId is aaa :" + callBackId); + setTimeout(() => { + globalThis.mainAbility4ListKey = listKey + globalThis.mainAbility4CallBackId = callBackId + console.log("listKey is :" + listKey); + console.log("callBackId is :" + callBackId); + }, 3000) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility4 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1003a8897aac8ba6eda48994656a7a493bb6843 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts @@ -0,0 +1,104 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility5 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility5 onCreate") + globalThis.abilityWant = want; + + var listKey = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityCreate") + listKey.push(abilityName+" onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityWindowStageCreate") + listKey.push(abilityName+" onAbilityWindowStageCreate"); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityForeground") + listKey.push(abilityName+" onAbilityForeground"); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityBackground") + listKey.push(abilityName+" onAbilityBackground"); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityWindowStageDestroy") + listKey.push(abilityName+" onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityDestroy") + listKey.push(abilityName+" onAbilityDestroy"); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityContinue") + listKey.push(abilityName+" onAbilityContinue"); + } + } + var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("callBackId is aaa :" + callBackId); + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap2MainAbility6 EventTest terminateSelf data: " + JSON.stringify(data)); + globalThis.mainAbility5ListKey = listKey + globalThis.mainAbility5CallBackId = callBackId + console.log("listKey is :" + listKey); + console.log("callBackId is :" + callBackId); + }).catch((error) => { + console.log("Hap2MainAbility6 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 1000) + } + + onDestroy() { + console.log("[Demo] MainAbility5 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility5 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/MainAbility5_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility5 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility5 onForeground") + + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility5 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts new file mode 100644 index 0000000000000000000000000000000000000000..885bd3d18e6623787775260b451f00efb5990356 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts @@ -0,0 +1,97 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility6 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility6 onCreate") + globalThis.abilityWant = want; + + var listKey = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityCreate") + listKey.push(abilityName+" onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityWindowStageCreate") + listKey.push(abilityName+" onAbilityWindowStageCreate"); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityForeground") + listKey.push(abilityName+" onAbilityForeground"); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityBackground") + listKey.push(abilityName+" onAbilityBackground"); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityWindowStageDestroy") + listKey.push(abilityName+" onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityDestroy") + listKey.push(abilityName+" onAbilityDestroy"); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName+" onAbilityContinue") + listKey.push(abilityName+" onAbilityContinue"); + } + } + var callBackId = this.context.getApplicationContext().registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("callBackId is aaa :" + callBackId); + setTimeout(() => { + globalThis.mainAbility6ListKey = listKey + globalThis.mainAbility6CallBackId = callBackId + console.log("listKey is :" + listKey); + console.log("callBackId is :" + callBackId); + }, 3000) + } + + onDestroy() { + console.log("[Demo] MainAbility6 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility6 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/MainAbility6_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility6 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility6 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility6 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..cdf7a82545994fd00cb28c2abf011aa41be4fc17 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets @@ -0,0 +1,32 @@ +// @ts-nocheck +/* + * 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. + */ +@Entry +@Component +struct MainAbility1_pages { + @State message: string = 'MainAbility1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..5aef19847f6a8d3b984e6fd07183afcb4689c57c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets @@ -0,0 +1,32 @@ +// @ts-nocheck +/* + * 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. + */ +@Entry +@Component +struct MainAbility2_pages { + @State message: string = 'MainAbility2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..80f93c74bfbeb67bb23153a2c2356b54ff97178b --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets @@ -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. + */ +@Entry +@Component +struct MainAbility3_pages { + @State message: string = 'MainAbility3_pages' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..34b2f2c25cf51f37968bad6042c77d6f585465d9 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets @@ -0,0 +1,32 @@ +// @ts-nocheck +/* + * 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. + */ +@Entry +@Component +struct MainAbility4_pages { + @State message: string = 'MainAbility4' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..3fa76011f2eabaaa69e9b639ec0032d444b419ff --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets @@ -0,0 +1,32 @@ +// @ts-nocheck +/* + * 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. + */ +@Entry +@Component +struct MainAbility5_pages { + @State message: string = 'MainAbility5' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..e274ffebee2863bb420dacb2150b901f2c67cf5d --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets @@ -0,0 +1,32 @@ +// @ts-nocheck +/* + * 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. + */ +@Entry +@Component +struct MainAbility6_pages { + @State message: string = 'MainAbility6' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..50269f6de0d759ae2090e20168ae02bca113b34d --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets @@ -0,0 +1,57 @@ +// @ts-nocheck +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import list from '../test/ListTest' + +@Entry +@Component +struct Index { + @State message: string = 'MainAbility' + + 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() + globalThis.abilityWant.parameters.timeout = 20000; + + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + configService.setConfig(globalThis.abilityWant.parameters) + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + list(globalThis.abilityContext) + core.execute() + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f178fdcaa1fd2ce9aa6c6870bbf9043b18c9504 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets @@ -0,0 +1,793 @@ +// @ts-nocheck +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" + +export default function abilityTest(abilityContext){ + + describe('AbilityTest', function() { + + console.info("-----------------LifecycleTest is start----------------") + + var TAG; + var listKeyTemp = []; + var listKeyTemp1 = []; + + + function sleep(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + + /* + * @tc.number Multihap_LifecycleTest_001 + * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_001", 0, async function (done) { + console.info("---------------Multihap_LifecycleTest_001 is start---------------") + TAG = "Multihap_LifecycleTest_001"; + listKeyTemp = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility3" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": Hap2MainAbility3 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { + if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility3") { + listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + } + } + console.log(TAG + "listKeyTemp is :" + listKeyTemp); + console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); + expect(listKeyTemp[0]).assertEqual("Hap2MainAbility3 onAbilityCreate"); + expect(listKeyTemp[1]).assertEqual("Hap2MainAbility3 onAbilityWindowStageCreate"); + expect(listKeyTemp[2]).assertEqual("Hap2MainAbility3 onAbilityForeground"); + expect(listKeyTemp[3]).assertEqual("Hap2MainAbility3 onAbilityBackground"); + expect(listKeyTemp[4]).assertEqual("Hap2MainAbility3 onAbilityWindowStageDestroy"); + expect(listKeyTemp[5]).assertEqual("Hap2MainAbility3 onAbilityDestroy"); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 4000) + }); + console.info("---------------Multihap_LifecycleTest_001 is end---------------") + }); + + /* + * @tc.number Multihap_LifecycleTest_002 + * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (single instance) + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_002", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_002 start-------------"); + TAG = "Multihap_LifecycleTest_002"; + listKeyTemp = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility4" + }, (error, data) => { + console.log(TAG + ":first Hap2MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility4" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap2MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for(var i = 0; i { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 3000) + }); + console.log("------------Multihap_LifecycleTest_002 end-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_003 + * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (multiple cases) + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_003", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_003 start-------------"); + TAG = "Multihap_LifecycleTest_003"; + listKeyTemp = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility5" + }, (error, data) => { + console.log(TAG + ":first Hap2MainAbility5 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility5" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap2MainAbility5 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for(var i = 0;i { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 3000) + }); + console.log("------------Multihap_LifecycleTest_003 end-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_004 + * @tc.name The ability of HAP A monitors the ability life cycle callback of HAP B and HAP C + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_004", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_004 start-------------"); + TAG = "Multihap_LifecycleTest_004"; + listKeyTemp = []; + listKeyTemp1 = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility6" + }, (error, data) => { + console.log(TAG + ":first Hap2MainAbility6 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap3MainAbility2" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap3MainAbility2 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for(var i = 0;i { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 3000) + }); + console.log("------------Multihap_LifecycleTest_004 end-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_005 + * @tc.name The ability of HAP A listens to two ability life cycle callbacks in HAP B + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_005", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_005 start-------------"); + TAG = "Multihap_LifecycleTest_005"; + listKeyTemp = []; + listKeyTemp1 = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility6" + }, (error, data) => { + console.log(TAG + ":first Hap2MainAbility6 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility7" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap2MainAbility7 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for(var i = 0;i { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 3000) + }); + console.log("------------end Multihap_LifecycleTest_005-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_006 + * @tc.name Repeat the registration. The ability of HAP A listens to the life + cycle callback of the ability of HAP B + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_006", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_006 start-------------"); + TAG = "Multihap_LifecycleTest_006"; + listKeyTemp = []; + listKeyTemp1 = []; + var firstCallbackId; + var secondCallbackId; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": first MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility8" + }, (error, data) => { + setTimeout(function(){ + console.log(TAG + ": first Hap2MainAbility8 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log(TAG + "first globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); + firstCallbackId = globalThis.mainAbility4CallBackId; + console.log(TAG + "firstCallbackId is : " + firstCallbackId); + }, 3000) + }); + + await sleep(1000); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": second MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility8" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap2MainAbility8 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for(var i = 0;i { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 3000) + }); + + console.log("------------Multihap_LifecycleTest_006 end-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_007 + * @tc.name Repeat registration and deregistration. The ability of HAP A listens to the life + cycle callback of the ability of HAP B + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_007", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_007 start-------------"); + TAG = "Multihap_LifecycleTest_007"; + listKeyTemp = []; + listKeyTemp1 = []; + var callBackId1; + var callBackId2; + var flag; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility6" + }, (error, data) => { + console.log(TAG + ": first MainAbility6 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + setTimeout(function(){ + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility9" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ":first Hap2MainAbility9 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + + for(var i = 0;i { + console.log(TAG + ": first unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + flag = error.code; + console.log(TAG + "flag is:" + flag); + }); + }, 3000) + }); + }, 1000) + + + setTimeout(function(){ + if(flag == 0){ + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility6" + }, (error, data) => { + console.log(TAG + ": first MainAbility6 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + setTimeout(function(){ + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility9" + }, (error, data) => { + + setTimeout(() => { + console.log(TAG + ":second Hap2MainAbility9 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + + for(var i = 0;i { + console.log(TAG + ": second unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 3000) + }) + }, 2000) + } + }, 10000) + + console.log("------------Multihap_LifecycleTest_007 end-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_008 + * @tc.name Repeat deregistration. The ability of HAP A listens to the life + cycle callback of the ability of HAP B + * @tc.desc Function test + * @tc.level 0 + */ + it("Multihap_LifecycleTest_008", 0, async function (done) { + console.log("------------Multihap_LifecycleTest_008 start-------------"); + TAG = "Multihap_LifecycleTest_008"; + listKeyTemp = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4" + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility6" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": Hap2MainAbility6 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + + for(var i = 0;i { + console.log(TAG + ": first unregisterAbilityLifecycleCallback, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue; + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { + console.log(TAG + ": second unregisterAbilityLifecycleCallback, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue; + done() + }); + }); + }, 4000) + }); + console.log("------------Multihap_LifecycleTest_008 end-------------"); + }); + + /* + * @tc.number Multihap_LifecycleTest_010 + * @tc.name Switch the front and background for many times to monitor the life cycle + * @tc.desc Function test + * @tc.level 0 + */ + it('Multihap_LifecycleTest_010', 0, async function (done) { + console.info("---------------Multihap_LifecycleTest_010 is start---------------") + TAG = "Multihap_LifecycleTest_010"; + listKeyTemp = []; + listKeyTemp1 = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility4", + }, (error, data) => { + console.log(TAG + ": MainAbility4 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + await sleep(1000) + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility10", + }, (error, data) => { + console.log(TAG + ": first Hap2MainAbility10 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + await sleep(1000) + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap3MainAbility3", + }, (error, data) => { + console.log(TAG + ": first Hap3MainAbility3 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + await sleep(1000) + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility10", + }, (error, data) => { + console.log(TAG + ": second Hap2MainAbility10 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + await sleep(1000) + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap3MainAbility3", + }, (error, data) => { + console.log(TAG + ": second Hap3MainAbility3 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + + await sleep(1000) + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap2MainAbility10", + }, (error, data) => { + console.log(TAG + ": third Hap2MainAbility10 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + await sleep(1000) + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap3MainAbility3", + }, (error, data) => { + + setTimeout(() => { + console.log(TAG + ": third Hap3MainAbility3 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + + for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { + if (globalThis.mainAbility4ListKey[i].substring(0, 17) == "Hap2MainAbility10") { + listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + }else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap3MainAbility3") { + listKeyTemp1.push(globalThis.mainAbility4ListKey[i]); + } + } + console.log(TAG + " listKeyTemp is :" + listKeyTemp); + console.log(TAG + " listKeyTemp1 is :" + listKeyTemp1); + console.log(TAG + " globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); + + expect(listKeyTemp[0]).assertEqual("Hap2MainAbility10 onAbilityCreate"); + expect(listKeyTemp[1]).assertEqual("Hap2MainAbility10 onAbilityWindowStageCreate"); + expect(listKeyTemp[2]).assertEqual("Hap2MainAbility10 onAbilityForeground"); + expect(listKeyTemp[3]).assertEqual("Hap2MainAbility10 onAbilityBackground"); + expect(listKeyTemp[4]).assertEqual("Hap2MainAbility10 onAbilityForeground"); + expect(listKeyTemp[5]).assertEqual("Hap2MainAbility10 onAbilityBackground"); + expect(listKeyTemp[6]).assertEqual("Hap2MainAbility10 onAbilityForeground"); + expect(listKeyTemp[7]).assertEqual("Hap2MainAbility10 onAbilityBackground"); + + expect(listKeyTemp1[0]).assertEqual("Hap3MainAbility3 onAbilityCreate"); + expect(listKeyTemp1[1]).assertEqual("Hap3MainAbility3 onAbilityWindowStageCreate"); + expect(listKeyTemp1[2]).assertEqual("Hap3MainAbility3 onAbilityForeground"); + expect(listKeyTemp1[3]).assertEqual("Hap3MainAbility3 onAbilityBackground"); + expect(listKeyTemp1[4]).assertEqual("Hap3MainAbility3 onAbilityForeground"); + expect(listKeyTemp1[5]).assertEqual("Hap3MainAbility3 onAbilityBackground"); + expect(listKeyTemp1[6]).assertEqual("Hap3MainAbility3 onAbilityForeground"); + + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 4000) + }) + console.info("---------------Multihap_LifecycleTest_010 is end---------------") + }) + + /* + * @tc.number Multihap_LifecycleTest_011 + * @tc.name The ability of HAP A listens to the life cycle callback + of the ability of HAP B in different processes + * @tc.desc Function test + * @tc.level 0 + */ + it('Multihap_LifecycleTest_011', 0, async function (done) { + console.info("---------------Multihap_LifecycleTest_011 is start---------------") + TAG = "Multihap_LifecycleTest_011"; + listKeyTemp = []; + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "MainAbility2", + }, (error, data) => { + console.log(TAG + ": Hap1MainAbility2 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + }) + + await sleep(500); + + abilityContext.startAbility({ + bundleName: "com.example.lifecycletest", + abilityName: "Hap4MainAbility1", + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": Hap4MainAbility1 startAbility success, err: " + + JSON.stringify(error) + ",data: " + JSON.stringify(data)); + + for (var i = 0; i < globalThis.mainAbility2ListKey.length; i++) { + if (globalThis.mainAbility2ListKey[i].substring(0, 16) == "Hap4MainAbility1") { + listKeyTemp.push(globalThis.mainAbility2ListKey[i]); + } + } + console.log(TAG + " listKeyTemp is :" + listKeyTemp); + console.log(TAG + " globalThis.mainAbility2CallBackId is :" + globalThis.mainAbility2CallBackId); + expect(listKeyTemp.length == 0).assertTrue(); + + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.mainAbility2CallBackId, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + expect(error.code == 0).assertTrue() + done(); + }); + }, 4000) + }); + console.info("---------------Multihap_LifecycleTest_011 is end---------------") + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fc84a6675194f4a068d6f954158172f0fb44187 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets @@ -0,0 +1,21 @@ +/* + * 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 lifecycleTest from './LifecycleTest' + +export default function List(context) { + + lifecycleTest(context) + +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..447e6ace6ebf38ed0a68d11facc3e27cedd50b96 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json @@ -0,0 +1,99 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.lifecycletest.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" + ] + }] + }, + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label" + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + }, + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", + "description": "$string:MainAbility4_desc", + "icon": "$media:icon", + "label": "$string:MainAbility4_label" + }, + { + "name": "MainAbility5", + "srcEntrance": "./ets/MainAbility5/MainAbility5.ts", + "description": "$string:MainAbility5_desc", + "icon": "$media:icon", + "label": "$string:MainAbility5_label" + }, + { + "name": "MainAbility6", + "srcEntrance": "./ets/MainAbility6/MainAbility6.ts", + "description": "$string:MainAbility6_desc", + "icon": "$media:icon", + "label": "$string:MainAbility6_label", + "launchType": "standard" + }], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.MANAGE_MISSIONS" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3603f45a9c94504e61de093cc1b141afcc7405e5 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,84 @@ +{ + "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": "ActsLifecycleMultihapTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "MainAbility4_desc", + "value": "description" + }, + { + "name": "MainAbility4_label", + "value": "label" + }, + { + "name": "MainAbility5_desc", + "value": "description" + }, + { + "name": "MainAbility5_label", + "value": "label" + }, + { + "name": "MainAbility6_desc", + "value": "description" + }, + { + "name": "MainAbility6_label", + "value": "label" + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Application/AbilityStage.ts diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bd2524dcc16aaef83e1e1f7b5bb1adaf7504c03 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts @@ -0,0 +1,57 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class Hap4MainAbility1 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap4MainAbility1 onCreate") + globalThis.abilityWant = want; + + setTimeout(()=>{ + this.context.terminateSelf().then((data) => { + console.log("[Demo] Hap4MainAbility1 terminateSelf windowStage data: " + JSON.stringify(data)) + }).catch((error) => { + console.log("[Demo] Hap4MainAbility1 terminateSelf windowStage error: " + JSON.stringify(error)) + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap4MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap4MainAbility1 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/Hap4MainAbility1_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap4MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap4MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap4MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..83b9b61865a3600ebe454389c508c2b5d0d4056c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hap4MainAbility1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..3bac8ff18e11056201cbf3171df82893faaedd94 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "hap4", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:hap4_desc", + "mainElement": "Hap4MainAbility1", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "process": "hap4mainability", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.lifecycletest.hap4mainability", + "srcEntrance": "./ets/hap4mainability/hap4mainability.ts", + "description": "$string:Hap4MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:Hap4MainAbility1_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.MANAGE_MISSIONS" + }, + { + "name": "ohos.permission.INSTALL_BUNDLE" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b7a137f352e99fa23871c3e63a57f70f9a9a2962 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/element/string.json @@ -0,0 +1,48 @@ +{ + "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": "ActsLifecycleMultihapTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "hap4_desc", + "value": "description" + }, + { + "name": "Hap4MainAbility1_desc", + "value": "description" + }, + { + "name": "Hap4MainAbility1_label", + "value": "label" + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/media/icon.png b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/media/icon.png rename to ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b b/ability/ability_runtime/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b rename to ability/ability_runtime/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/app.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8d3530ad88d849a17ea460cd45e84dc62640c65c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.lifecycle_xts", + "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 + } + } +} diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9f5968071d165964036c9e3c39ff4a04b3aa4506 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"LifeCycle_XTS" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/stage/actslifecyclesinglehaptest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/BUILD.gn b/ability/ability_runtime/stage/actslifecyclesinglehaptest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..431d74fb0251798e1eafb8c58b37827df91ca9f5 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/BUILD.gn @@ -0,0 +1,40 @@ +# 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("ActsLifecycleSingleHapTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actslifecyclesinglehaptest_js_assets", + ":actslifecyclesinglehaptest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsLifecycleSingleHapTest" +} + +ohos_app_scope("actslifecyclesinglehaptest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actslifecyclesinglehaptest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actslifecyclesinglehaptest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actslifecyclesinglehaptest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/Test.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..916b765f73ce3d1681a2a692f246a265d1e91876 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.lifecycle_xts", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsLifecycleSingleHapTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility1/Hap1MainAbility1.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility1/Hap1MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..ded1affab04861ec4b1f6bfac452dfc89cf127ac --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility1/Hap1MainAbility1.ts @@ -0,0 +1,55 @@ +/* + * 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 Hap1MainAbility1 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap1MainAbility1 onCreate") + globalThis.abilityWant = want; + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap1MainAbility1 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap1MainAbility1 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap1MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap1MainAbility1 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/indexh1a1", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap1MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap1MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap1MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility2/Hap1MainAbility2.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility2/Hap1MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..f8552bfa873dda74f3ee4f1e8de20655996c7cd1 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Hap1MainAbility2/Hap1MainAbility2.ts @@ -0,0 +1,56 @@ +/* + * 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 Hap1MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] Hap1MainAbility2 onCreate") + globalThis.abilityWant = want; + + setTimeout(() => { + this.context.terminateSelf().then((data) => { + console.log("Hap1MainAbility2 EventTest terminateSelf data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("Hap1MainAbility2 EventTest terminateSelf error: " + JSON.stringify(error)); + }) + }, 2000) + } + + onDestroy() { + console.log("[Demo] Hap1MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] Hap1MainAbility2 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/indexh1a2", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] Hap1MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] Hap1MainAbility2 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] Hap1MainAbility2 onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..245fde7135b60e4843ac8f1d20ee9021e886f2e3 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,48 @@ +/* + * 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) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context; + windowStage.setUIContent(this.context, "pages/index", 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") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..df05232e46819e2e8ce83fb916328dcc5ec3d0ae --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,131 @@ +/* + * 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 MainAbility1 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility1 onCreate") + globalThis.abilityWant = want; + console.log("[Demo] MainAbility1 context: " + JSON.stringify(this.context)); + var listKey1 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey1.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey1:" + JSON.stringify(listKey1)); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey1.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey1:" + JSON.stringify(listKey1)); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey1.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey1:" + JSON.stringify(listKey1)); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey1.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey1:" + JSON.stringify(listKey1)); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey1.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey1:" + JSON.stringify(listKey1)); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey1.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey1:" + JSON.stringify(listKey1)); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback1 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback1 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey1.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey1:" + JSON.stringify(listKey1)); + } + } + let applicationContext = this.context.getApplicationContext(); + console.log("[Demo] MainAbility1 applicationContext: " + JSON.stringify(applicationContext)); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback1 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback1 listKey: " + JSON.stringify(listKey1)); + globalThis.list1 = listKey1; + globalThis.callbackid1 = lifecycleid; + }, 2500); + } + + onDestroy() { + console.log("[Demo] MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility1 onWindowStageCreate") + globalThis.ability1context = this.context; + windowStage.setUIContent(this.context, "pages/index1", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts new file mode 100644 index 0000000000000000000000000000000000000000..c134f1ebb558c622039e2aacfa8fd85fa581a3d3 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts @@ -0,0 +1,116 @@ +/* + * 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 MainAbility10 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility10 onCreate") + globalThis.abilityWant = want; + var listKey10 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey10.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey10:" + JSON.stringify(listKey10)); + }, + onAbilityWindowStageCreate(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey10.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey10:" + JSON.stringify(listKey10)); + }, + onAbilityWindowStageDestroy(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey10.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey10:" + JSON.stringify(listKey10)); + }, + onAbilityDestroy(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey10.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey10:" + JSON.stringify(listKey10)); + }, + onAbilityForeground(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey10.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey10:" + JSON.stringify(listKey10)); + }, + onAbilityBackground(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey10.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey10:" + JSON.stringify(listKey10)); + }, + onAbilityContinue(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback10 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey10.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey10:" + JSON.stringify(listKey10)); + } + } + let applicationContext = this.context.getApplicationContext(); + console.log("[Demo] MainAbility10 applicationContext: " + JSON.stringify(applicationContext)); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback10 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback10 listKey: " + JSON.stringify(listKey10)); + globalThis.list10 = listKey10; + globalThis.callbackid10 = lifecycleid; + }, 1500); + } + + onDestroy() { + console.log("[Demo] MainAbility10 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility10 onWindowStageCreate") + globalThis.ability10 = this.context; + windowStage.setUIContent(this.context, "pages/index10", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility10 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility10 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility10 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb1e56d50a21e9be5236fe602f3d8dc8534d777d --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts @@ -0,0 +1,110 @@ +/* + * 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 MainAbility11 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility11 onCreate") + globalThis.abilityWant = want; + globalThis.ability11 = this.context; + var listKey11 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey11.push(abilityname + " onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey11.push(abilityname + " onAbilityWindowStageCreate"); + }, + onAbilityWindowStageDestroy(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey11.push(abilityname + " onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey11.push(abilityname + " onAbilityDestroy"); + }, + onAbilityForeground(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey11.push(abilityname + " onAbilityForeground"); + }, + onAbilityBackground(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey11.push(abilityname + " onAbilityBackground"); + }, + onAbilityContinue(ability) { + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback11 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey11.push(abilityname + " onAbilityContinue"); + } + } + let applicationContext = globalThis.ability11.getApplicationContext(); + console.log("[Demo] MainAbility11 applicationContext: " + JSON.stringify(applicationContext)); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback11 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback11 listKey: " + JSON.stringify(listKey11)); + globalThis.list11 = listKey11; + globalThis.callbackid11 = lifecycleid; + }, 2000); + } + + onDestroy() { + console.log("[Demo] MainAbility11 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility11 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index11", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility11 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility11 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts new file mode 100644 index 0000000000000000000000000000000000000000..19f577b7ff6f2f1c3d4523b359310600ad4d9146 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts @@ -0,0 +1,109 @@ +/* + * 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 MainAbility12 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility12 onCreate") + globalThis.abilityWant = want; + var listKey12 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey12.push(abilityname + " onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey12.push(abilityname + " onAbilityWindowStageCreate"); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey12.push(abilityname + " onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey12.push(abilityname + " onAbilityDestroy"); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey12.push(abilityname + " onAbilityForeground"); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey12.push(abilityname + " onAbilityBackground"); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback12 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey12.push(abilityname + " onAbilityContinue"); + } + } + let applicationContext = this.context.getApplicationContext(); + console.log("[Demo] MainAbility12 applicationContext: " + JSON.stringify(applicationContext)); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback12 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback12 listKey: " + JSON.stringify(listKey12)); + globalThis.list12 = listKey12; + globalThis.callbackid12 = lifecycleid; + }, 1700); + } + + onDestroy() { + console.log("[Demo] MainAbility12 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility12 onWindowStageCreate") + globalThis.ability12 = this.context; + windowStage.setUIContent(this.context, "pages/index12", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility12 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility12 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility12 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd6a71c86aae9a16fa940e4ed0443e01faf42cf7 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,56 @@ +/* + * 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 MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility2 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility2 onWindowStageCreate") + globalThis.ability2 = this.context; + windowStage.setUIContent(this.context, "pages/index2", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility2 onForeground") + setTimeout(function () { + globalThis.ability2.terminateSelf() + .then((data) => { + console.info('[Demo] MainAbility2 terminateself succeeded: ' + data); + }).catch((error) => { + console.error('[Demo] MainAbility2 terminateself failed. Cause: ' + error); + }) + }, 500); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ba38e1e4714d693b1c98a5256ef68cc34422f38 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,132 @@ +/* + * 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 MainAbility3 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility3 onCreate") + globalThis.abilityWant = want; + + console.log("[Demo] MainAbility3 context: " + JSON.stringify(this.context)); + var listKey3 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey3.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey3:" + JSON.stringify(listKey3)); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey3.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey3:" + JSON.stringify(listKey3)); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey3.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey3:" + JSON.stringify(listKey3)); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey3.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey3:" + JSON.stringify(listKey3)); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey3.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey3:" + JSON.stringify(listKey3)); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey3.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey3:" + JSON.stringify(listKey3)); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback3 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback3 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey3.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey3:" + JSON.stringify(listKey3)); + } + } + let applicationContext = this.context.getApplicationContext(); + console.log("[Demo] MainAbility3 applicationContext: " + JSON.stringify(applicationContext)); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback3 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback3 listKey : " + JSON.stringify(listKey3)); + globalThis.list3 = listKey3; + globalThis.callbackid3 = lifecycleid; + }, 2000); + } + + onDestroy() { + console.log("[Demo] MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility3 onWindowStageCreate") + globalThis.ability3 = this.context + windowStage.setUIContent(this.context, "pages/index3", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts new file mode 100644 index 0000000000000000000000000000000000000000..74bfcc2d758b757b5910a2878226b969c057b749 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts @@ -0,0 +1,140 @@ +/* + * 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 MainAbility4 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility4 onCreate") + globalThis.abilityWant = want; + + console.log("[Demo] MainAbility4 context: " + JSON.stringify(this.context)); + var listKey4 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey4.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey4:" + JSON.stringify(listKey4)); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey4.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey4:" + JSON.stringify(listKey4)); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey4.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey4:" + JSON.stringify(listKey4)); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey4.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey4:" + JSON.stringify(listKey4)); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey4.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey4:" + JSON.stringify(listKey4)); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey4.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey4:" + JSON.stringify(listKey4)); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback4 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback4 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey4.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey4:" + JSON.stringify(listKey4)); + } + } + let applicationContext = this.context.getApplicationContext(); + console.log("[Demo] MainAbility4 applicationContext: " + JSON.stringify(applicationContext)); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback4 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback4 listKey : " + JSON.stringify(listKey4)); + globalThis.list4 = listKey4; + globalThis.callbackid4 = lifecycleid; + }, 1500); + } + + onDestroy() { + console.log("[Demo] MainAbility4 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility4 onWindowStageCreate") + globalThis.ability4 = this.context; + windowStage.setUIContent(this.context, "pages/index4", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility4 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility4 onForeground") + setTimeout(function () { + globalThis.ability4.terminateSelf() + .then((data) => { + console.info('[Demo] MainAbility4 terminateself succeeded: ' + data); + }).catch((error) => { + console.error('[Demo] MainAbility4 terminateself failed. Cause: ' + error); + }) + }, 5000); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility4 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts new file mode 100644 index 0000000000000000000000000000000000000000..a37e29a1855d4c7bb890260bd4745ec27364e5e1 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts @@ -0,0 +1,56 @@ +/* + * 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 MainAbility5 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility5 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility5 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility5 onWindowStageCreate") + globalThis.ability5 = this.context; + windowStage.setUIContent(this.context, "pages/index5", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility5 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility5 onForeground") + setTimeout(function () { + globalThis.ability5.terminateSelf() + .then((data) => { + console.info('[Demo] MainAbility5 terminateself succeeded: ' + data); + }).catch((error) => { + console.error('[Demo] MainAbility5 terminateself failed. Cause: ' + error); + }) + }, 500); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility5 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a5ba0d6bc5ffa8b4440408aed0c6e46635ee37d --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts @@ -0,0 +1,130 @@ +/* + * 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 MainAbility6 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility6 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility6 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility6 onWindowStageCreate") + globalThis.ability6 = this.context; + windowStage.setUIContent(this.context, "pages/index6", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility6 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility6 onForeground") + + var listKey6 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey6.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey6:" + JSON.stringify(listKey6)); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey6.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey6:" + JSON.stringify(listKey6)); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey6.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey6:" + JSON.stringify(listKey6)); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey6.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey6:" + JSON.stringify(listKey6)); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey6.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey6:" + JSON.stringify(listKey6)); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey6.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey6:" + JSON.stringify(listKey6)); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback6 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback6 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey6.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey6:" + JSON.stringify(listKey6)); + } + } + let applicationContext = globalThis.ability6.getApplicationContext(); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] registerAbilityLifecycleCallback6 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] registerAbilityLifecycleCallback6 listKey: " + JSON.stringify(listKey6)); + globalThis.list6 = listKey6; + globalThis.callbackid6 = lifecycleid; + }, 1500); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility6 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts new file mode 100644 index 0000000000000000000000000000000000000000..863ef25ad0bd8c93d7327cb2160f6f4d7f9dd485 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts @@ -0,0 +1,130 @@ +/* + * 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 MainAbility7 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility7 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility7 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility7 onWindowStageCreate") + globalThis.ability7 = this.context; + windowStage.setUIContent(this.context, "pages/index7", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility7 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility7 onForeground") + + var listKey7 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey7.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey7:" + JSON.stringify(listKey7)); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey7.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey7:" + JSON.stringify(listKey7)); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey7.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey7:" + JSON.stringify(listKey7)); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey7.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey7:" + JSON.stringify(listKey7)); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey7.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey7:" + JSON.stringify(listKey7)); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey7.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey7:" + JSON.stringify(listKey7)); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback7 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback7 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey7.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey7:" + JSON.stringify(listKey7)); + } + } + let applicationContext = this.context.getApplicationContext(); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] AbilityLifecycleCallback7 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] AbilityLifecycleCallback7 listKey: " + JSON.stringify(listKey7)); + globalThis.list7 = listKey7; + globalThis.callbackid7 = lifecycleid; + }, 1500); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility7 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts new file mode 100644 index 0000000000000000000000000000000000000000..31a6b401927718b1967cecd8c92be734969b3626 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts @@ -0,0 +1,130 @@ +/* + * 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 MainAbility8 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility8 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility8 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility8 onWindowStageCreate") + globalThis.ability8 = this.context; + windowStage.setUIContent(this.context, "pages/index8", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility8 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility8 onForeground") + var listKey8 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityCreate"); + listKey8.push(abilityname + " onAbilityCreate"); + console.log("[Demo] 1listKey8:" + JSON.stringify(listKey8)); + }, + onAbilityWindowStageCreate(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageCreate ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageCreate abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageCreate"); + listKey8.push(abilityname + " onAbilityWindowStageCreate"); + console.log("[Demo] 2listKey8:" + JSON.stringify(listKey8)); + }, + onAbilityWindowStageDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityWindowStageDestroy"); + listKey8.push(abilityname + " onAbilityWindowStageDestroy"); + console.log("[Demo] 3listKey8:" + JSON.stringify(listKey8)); + }, + onAbilityDestroy(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityDestroy"); + listKey8.push(abilityname + " onAbilityDestroy"); + console.log("[Demo] 4listKey8:" + JSON.stringify(listKey8)); + }, + onAbilityForeground(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityForeground"); + listKey8.push(abilityname + " onAbilityForeground"); + console.log("[Demo] 5listKey8:" + JSON.stringify(listKey8)); + }, + onAbilityBackground(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityBackground"); + listKey8.push(abilityname + " onAbilityBackground"); + console.log("[Demo] 6listKey8:" + JSON.stringify(listKey8)); + }, + onAbilityContinue(ability) { + console.log("[Demo] AbilityLifecycleCallback8 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log("[Demo] AbilityLifecycleCallback8 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log("[Demo] " + abilityname + " onAbilityContinue"); + listKey8.push(abilityname + " onAbilityContinue"); + console.log("[Demo] 7listKey8:" + JSON.stringify(listKey8)); + } + } + let applicationContext = this.context.getApplicationContext(); + let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log("[Demo] AbilityLifecycleCallback8 number: " + JSON.stringify(lifecycleid)); + setTimeout(function () { + console.log("[Demo] AbilityLifecycleCallback8 listKey: " + JSON.stringify(listKey8)); + globalThis.list8 = listKey8; + globalThis.callbackid8 = lifecycleid; + }, 1500); + + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility8 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts new file mode 100644 index 0000000000000000000000000000000000000000..0056e6dd637d55a204a7c9bce00b52657f53c1fd --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts @@ -0,0 +1,98 @@ +/* + * 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 MainAbility9 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility9 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility9 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility9 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index9", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility9 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility9 onForeground") + + var listKey9 = []; + var abilityName = ""; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityCreate") + listKey9.push(abilityName + " onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityWindowStageCreate") + listKey9.push(abilityName + " onAbilityWindowStageCreate"); + }, + onAbilityForeground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityForeground") + listKey9.push(abilityName + " onAbilityForeground"); + }, + onAbilityBackground(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityBackground") + listKey9.push(abilityName + " onAbilityBackground"); + }, + onAbilityWindowStageDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityWindowStageDestroy") + listKey9.push(abilityName + " onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityDestroy") + listKey9.push(abilityName + " onAbilityDestroy"); + }, + onAbilityContinue(ability) { + abilityName = ability.context.abilityInfo.name; + console.log(abilityName + " onAbilityContinue") + listKey9.push(abilityName + " onAbilityContinue"); + } + } + var callBackId = this.context.getApplicationContext() + .registerAbilityLifecycleCallback(AbilityLifecycleCallback); + + console.log("callBackId is aaa :" + callBackId); + setTimeout(() => { + globalThis.mainAbility9ListKey = listKey9 + globalThis.mainAbility9CallBackId = callBackId + console.log("listKey is :" + listKey9); + console.log("callBackId is :" + callBackId); + }, 3000) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility9 onBackground") + } +}; diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e279086a082c8f5d1a57617e1ca4b32723468651 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,55 @@ +// @ts-nocheck +/* + * 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" +import List from '../test/ListTest' + +@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() + globalThis.abilityWant.parameters.timeout = 10000; + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + configService.setConfig(globalThis.abilityWant.parameters); + List(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index1.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index1.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f0560de7982c21e63ea0117b07f0e915168fdb8 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index1.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index1 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability1') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index10.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index10.ets new file mode 100644 index 0000000000000000000000000000000000000000..faf118b3234d5c0dc95f67e7d2da3dc53f0972d5 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index10.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index10 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability10') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index11.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index11.ets new file mode 100644 index 0000000000000000000000000000000000000000..fbcf1d266d4b9485bca7e71dce1f43ea4eb7f143 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index11.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index11 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability11') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index12.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index12.ets new file mode 100644 index 0000000000000000000000000000000000000000..054b13b6ea6352c0917b2c7f1ad1c709c8211c97 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index12.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index12 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability12') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..3454fec431af36ac22d7c90ab7f91888c0a7e7d5 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index2 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability2') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index3.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index3.ets new file mode 100644 index 0000000000000000000000000000000000000000..1da36da3dc0a111d17e1fe35b97eac8c487dc094 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index3.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index3 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability3') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index4.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index4.ets new file mode 100644 index 0000000000000000000000000000000000000000..93ff08b658732de020985aebc5e477b267a36b24 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index4.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index4 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability4') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index5.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index5.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c3c2904435e5f6b0077226395c7367184f3253b --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index5.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index5 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability5') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index6.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index6.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8c2b4e158f8a43dbbe50e0c2523a76d4c50526b --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index6.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index6 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability6') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index7.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index7.ets new file mode 100644 index 0000000000000000000000000000000000000000..2acfc9b169578217a606b1f359a5ba21c74c433c --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index7.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index7 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability7') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index8.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index8.ets new file mode 100644 index 0000000000000000000000000000000000000000..40ebaa205b49da94ae0c463d02e7505fca6aef30 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index8.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index8 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability8') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index9.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index9.ets new file mode 100644 index 0000000000000000000000000000000000000000..7aeb889946121ecfbf7f07c89532c7eb7e10cd30 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/index9.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct Index9 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability9') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a1.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a1.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a5bc62f94379a3215966330b85c580968adc9c6 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a1.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct indexh1a1 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Hap1MainAbility1') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a2.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a2.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e82f9dfd5a86bfb61d4412c9374120bc5d09769 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/pages/indexh1a2.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ +@Entry +@Component +struct indexh1a2 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Hap1MainAbility2') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b709cc9559bd152987ebb3bc6d346beb2fe7f615 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets @@ -0,0 +1,1593 @@ +// @ts-nocheck +/* + * 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 "deccjsunit/index" + +export default function lifecycleTest(abilityContext) { + describe('LifeCycleTest', function () { + + beforeEach(async function (done) { + console.info('LifeCycleTest before each called'); + await sleep(1000); + done() + }); + + afterEach(async function (done) { + console.info('LifeCycleTest after each called'); + if ("Singlehap_LifeCycleTest_0200" === TAG || "Singlehap_LifeCycleTest_0300" === TAG + || "Singlehap_LifeCycleTest_0500" === TAG || "Singlehap_LifeCycleTest_0600" === TAG + || "Singlehap_LifeCycleTest_0800" === TAG || "Singlehap_LifeCycleTest_0900" === TAG) { + var para = { + resultCode: 2, + want: { + "abilityName": "MainAbility1", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log("LifeCycleTest terminateSelfwithresult para: " + JSON.stringify(para)); + await globalThis.ability1context.terminateSelfWithResult(para) + .then((data) => { + console.log("LifeCycleTest terminateSelfwithresult successful data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("LifeCycleTest terminateSelfwithresult error: " + JSON.stringify(error)); + }); + } else if ("Singlehap_LifeCycleTest_2000" === TAG) { + var para1 = { + resultCode: 2, + want: { + "abilityName": "MainAbility12", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log("LifeCycleTest terminateSelfwithresult para: " + JSON.stringify(para1)); + await globalThis.ability12.terminateSelfWithResult(para1) + .then((data) => { + console.log("LifeCycleTest terminateSelfwithresult successful data: " + JSON.stringify(data)); + }).catch((error) => { + console.log("LifeCycleTest terminateSelfwithresult error: " + JSON.stringify(error)); + }); + } + done(); + }); + + var TAG = ""; + var listKeyTemp = "" + function sleep(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + /* + * @tc.number Singlehap_LifeCycleTest_0100 + * @tc.name Register in abilitystage,listen to the lifecycle of abilityA,deregister after listening + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0100", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0100 START-------------"); + TAG = "Singlehap_LifeCycleTest_0100"; + var code; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list)); + console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list.length; i++) { + strtemp = globalThis.list[i].substring(0, 12); + if (strtemp === "MainAbility2") { + listtemp.push(globalThis.list[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + globalThis.abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + }); + setTimeout(function () { + expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(code).assertEqual(0); + console.log("------------Singlehap_LifeCycleTest_0100 END-------------"); + done(); + }, 1000); + }, 3000); + }) + + /* + * @tc.number Singlehap_LifeCycleTest_0200 + * @tc.name Register in abilityA,listen to the lifecycle of abilityB,deregister after listening + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0200", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0200 START-------------"); + TAG = "Singlehap_LifeCycleTest_0200"; + var code; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); + var list = globalThis.list1 + console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list1.length; i++) { + strtemp = globalThis.list1[i].substring(0, 12); + if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { + listtemp.push(globalThis.list1[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + }) + setTimeout(function () { + expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); + expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); + expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(code).assertEqual(0); + console.log("------------Singlehap_LifeCycleTest_0200 END-------------"); + done(); + }, 1000); + }, 3000); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0300 + * @tc.name Register in abilityA,listening the lifecycle of abilityB,deregister,repeat the unregister + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0300", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0300 START-------------"); + TAG = "Singlehap_LifeCycleTest_0300"; + var code; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); + console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list1.length; i++) { + strtemp = globalThis.list1[i].substring(0, 12); + if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { + listtemp.push(globalThis.list1[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1) + .then((data) => { + console.info(TAG + ' unregisterAbilityLifecycleCallback successful. Data: ' + data); + }) + .catch((error) => { + console.error(TAG + ' unregisterAbilityLifecycleCallback failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + console.log(TAG + " secondunregister callbackid : " + JSON.stringify(globalThis.callbackid1)); + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback_1 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + }) + }, 500); + setTimeout(function () { + expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); + expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); + expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(code).assertEqual(1); + console.log("------------Singlehap_LifeCycleTest_0300 END-------------"); + done(); + }, 2000); + }, 3000); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0400 + * @tc.name Register in abilityA,listening the lifecycle of abilityB,terminate abilityA,unregister + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0400", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0400 START-------------"); + TAG = "Singlehap_LifeCycleTest_0400"; + var code; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility3", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start3 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start3 failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start2 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start2 failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list3)); + console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid3)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list3.length; i++) { + strtemp = globalThis.list3[i].substring(0, 12); + if (strtemp === "MainAbility3" || strtemp === "MainAbility2") { + listtemp.push(globalThis.list3[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + var para = { + resultCode: 1, + want: { + "abilityName": "MainAbility3", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); + globalThis.ability3.terminateSelfWithResult(para) + .then((data) => { + console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); + }); + setTimeout(function () { + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid3, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback3 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + }) + }, 500); + setTimeout(function () { + expect(exlist[0]).assertEqual("MainAbility3 onAbilityWindowStageCreate"); + expect(exlist[1]).assertEqual("MainAbility3 onAbilityForeground"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[5]).assertEqual("MainAbility3 onAbilityBackground"); + expect(exlist[6]).assertEqual("MainAbility3 onAbilityForeground"); + expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(code).assertEqual(0); + console.log("------------Singlehap_LifeCycleTest_0400 END-------------"); + done(); + }, 1000); + }, 3000); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0500 + * @tc.name Register in abilityA and abilityB,unregister MainabilityB,then Register in ManinabilityC + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0500", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0500 START-------------"); + TAG = "Singlehap_LifeCycleTest_0500"; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start1 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start1 failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility3", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start3 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start3 failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + console.log(TAG + " start after callbackid3 : " + JSON.stringify(globalThis.callbackid3)); + globalThis.abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid3) + .then((data) => { + console.info(TAG + ' unregisterAbilityLifecycleCallback3 successful. Data: ' + data); + }) + .catch((error) => { + console.error(TAG + ' unregisterAbilityLifecycleCallback3 failed. Cause: ' + JSON.stringify(error)); + }); + var str2 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility4", + } + globalThis.abilityContext.startAbility(str2) + .then((data) => { + console.info(TAG + ' start4 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start4 failed. Cause: ' + JSON.stringify(error)); + }) + }, 2800); + setTimeout(function () { + console.log(TAG + " listKey1 : " + JSON.stringify(globalThis.list1)); + console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1)); + console.log(TAG + " listKey3 : " + JSON.stringify(globalThis.list3)); + console.log(TAG + " callbackid3 : " + JSON.stringify(globalThis.callbackid3)); + let id3 = globalThis.callbackid3; + console.log(TAG + " listKey4 : " + JSON.stringify(globalThis.list4)); + console.log(TAG + " callbackid4 : " + JSON.stringify(globalThis.callbackid4)); + let id4 = globalThis.callbackid4; + expect(id3 + 1).assertEqual(id4); + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid4, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback4 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }) + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback1 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_0500 END-------------"); + done(); + }) + }, 4500); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0600 + * @tc.name Register in abilityA,start abilityB、abilityC,terminate abilityB 、abilityC + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0600", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0600 START-------------"); + TAG = "Singlehap_LifeCycleTest_0600"; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start1 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start1 failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility5", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start5 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start5 failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + var str2 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str2) + .then((data) => { + console.info(TAG + ' start2 successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start2 failed. Cause: ' + JSON.stringify(error)); + }) + }, 1100); + setTimeout(function () { + console.log(TAG + " listKey1 : " + JSON.stringify(globalThis.list1)); + console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list1.length; i++) { + strtemp = globalThis.list1[i].substring(0, 12); + if (strtemp == "MainAbility5" || strtemp == "MainAbility2") { + listtemp.push(globalThis.list1[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + expect(exlist[0]).assertEqual("MainAbility5 onAbilityCreate"); + expect(exlist[1]).assertEqual("MainAbility5 onAbilityWindowStageCreate"); + expect(exlist[2]).assertEqual("MainAbility5 onAbilityForeground"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[6]).assertEqual("MainAbility5 onAbilityBackground"); + expect(exlist[7]).assertEqual("MainAbility5 onAbilityWindowStageDestroy"); + expect(exlist[8]).assertEqual("MainAbility5 onAbilityDestroy"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[10]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[11]).assertEqual("MainAbility2 onAbilityDestroy"); + globalThis.ability1context.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_0600 END-------------"); + done(); + }) + }, 4200); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0700 + * @tc.name Multiple registration/unregistration + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0700", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0700 START-------------"); + TAG = "Singlehap_LifeCycleTest_0700"; + var code1; + var code2; + var code3; + var id1; + var id2; + var id3; + var listKey8 = []; + let AbilityLifecycleCallback = { + onAbilityCreate(ability) { + console.log(TAG + " onAbilityCreate ability:" + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " onAbilityCreate abilityname:" + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityCreate"); + listKey8.push(abilityname + " onAbilityCreate"); + }, + onAbilityWindowStageCreate(ability) { + console.log(TAG + " onAbilityWindowStageCreate ability:" + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " onAbilityWindowStageCreate abilityname:" + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityWindowStageCreate"); + listKey8.push(abilityname + " onAbilityWindowStageCreate"); + }, + onAbilityWindowStageDestroy(ability) { + console.log(TAG + " AbilityLifecycleCallback1 onAbilityWindowStageDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " AbilityLifecycleCallback1 onAbilityWindowStageDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityWindowStageDestroy"); + listKey8.push(abilityname + " onAbilityWindowStageDestroy"); + }, + onAbilityDestroy(ability) { + console.log(TAG + " AbilityLifecycleCallback1 onAbilityDestroy ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " AbilityLifecycleCallback1 onAbilityDestroy abilityname:" + + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityDestroy"); + listKey8.push(abilityname + " onAbilityDestroy"); + }, + onAbilityForeground(ability) { + console.log(TAG + " AbilityLifecycleCallback1 onAbilityForeground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " AbilityLifecycleCallback1 onAbilityForeground abilityname:" + + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityForeground"); + listKey8.push(abilityname + " onAbilityForeground"); + }, + onAbilityBackground(ability) { + console.log(TAG + " AbilityLifecycleCallback1 onAbilityBackground ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " AbilityLifecycleCallback1 onAbilityBackground abilityname:" + + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityBackground"); + listKey8.push(abilityname + " onAbilityBackground"); + }, + onAbilityContinue(ability) { + console.log(TAG + " AbilityLifecycleCallback1 onAbilityContinue ability:" + + JSON.stringify(ability)); + let abilityname = ability.context.abilityInfo.name; + console.log(TAG + " AbilityLifecycleCallback1 onAbilityContinue abilityname:" + + JSON.stringify(abilityname)); + console.log(TAG + " " + abilityname + " onAbilityContinue"); + listKey8.push(abilityname + " onAbilityContinue"); + } + } + let applicationContext = globalThis.abilityContext.getApplicationContext(); + id1 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log(TAG + " registerAbilityLifecycleCallback1 number: " + JSON.stringify(id1)); + applicationContext.unregisterAbilityLifecycleCallback(id1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback1 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code1 = error.code; + }) + setTimeout(function () { + id2 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log(TAG + " registerAbilityLifecycleCallback2 number: " + JSON.stringify(id2)); + applicationContext.unregisterAbilityLifecycleCallback(id2, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback2 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code2 = error.code; + }) + }, 1000); + setTimeout(function () { + id3 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + console.log(TAG + " registerAbilityLifecycleCallback3 number: " + JSON.stringify(id3)); + applicationContext.unregisterAbilityLifecycleCallback(id3, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback3 success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code3 = error.code; + expect(id1 > 0).assertTrue(); + expect(id2).assertEqual(id1 + 1); + expect(id3).assertEqual(id2 + 1); + expect(code1).assertEqual(0); + expect(code2).assertEqual(0); + expect(code3).assertEqual(0); + console.log("------------Singlehap_LifeCycleTest_0700 END-------------"); + done(); + }) + }, 3000); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0800 + * @tc.name Maninability1 Register listening, Repeat starting and termination Ability2 + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0800", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0800 START-------------"); + TAG = "Singlehap_LifeCycleTest_0800"; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 3000); + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 4500); + setTimeout(function () { + console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); + console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list1.length; i++) { + strtemp = globalThis.list1[i].substring(0, 12); + if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { + listtemp.push(globalThis.list1[i]); + } + } + console.log(TAG + " listtemp is :" + listtemp); + let exlist = listtemp; + expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); + expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); + expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(exlist[10]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[11]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[12]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[13]).assertEqual("MainAbility1 onAbilityBackground"); + expect(exlist[14]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[15]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[16]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[17]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(exlist[18]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[19]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[20]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[21]).assertEqual("MainAbility1 onAbilityBackground"); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_0800 END-------------"); + done(); + }); + }, 4950); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_0900 + * @tc.name Repeat switching Ability1 between front and back + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_0900", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_0900 START-------------"); + TAG = "Singlehap_LifeCycleTest_0900"; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 2000); + setTimeout(function () { + console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1)); + console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list1.length; i++) { + strtemp = globalThis.list1[i].substring(0, 12); + if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { + listtemp.push(globalThis.list1[i]); + } + } + console.log(TAG + " listtemp is :" + listtemp); + let exlist = listtemp; + expect(exlist[0]).assertEqual("MainAbility1 onAbilityWindowStageCreate"); + expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[5]).assertEqual("MainAbility1 onAbilityBackground"); + expect(exlist[6]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[7]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(exlist[10]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[11]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[12]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[13]).assertEqual("MainAbility1 onAbilityBackground"); + expect(exlist[14]).assertEqual("MainAbility1 onAbilityForeground"); + expect(exlist[15]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[16]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[17]).assertEqual("MainAbility2 onAbilityDestroy"); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_0900 END-------------"); + done(); + }); + }, 4000); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1000 + * @tc.name Register listening in abilityA foreground,repeat the registration + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_1000", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1000 START-------------"); + TAG = "Singlehap_LifeCycleTest_1000"; + var id1; + var id2; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility6", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list6)); + console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid6)); + id1 = globalThis.callbackid6; + console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 2000); + setTimeout(function () { + console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list6)); + console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid6)); + id2 = globalThis.callbackid6; + console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); + expect(id1 + 1).assertEqual(id2); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid6, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_1000 END-------------"); + done(); + }); + }, 4500); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1100 + * @tc.name Register listening in abilityA foreground,repeat the registration (singleton) + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_1100", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1100 START-------------"); + TAG = "Singlehap_LifeCycleTest_1100"; + var id1; + var id2; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility7", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list7)); + console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid7)); + id1 = globalThis.callbackid7; + console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility7", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 2000); + setTimeout(function () { + console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list7)); + console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid7)); + id2 = globalThis.callbackid7; + console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); + expect(id1).assertEqual(id2); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid7, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + var para = { + resultCode: 1, + want: { + "abilityName": "MainAbility1", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); + globalThis.ability7.terminateSelfWithResult(para, (error, data) => { + console.log(TAG + " terminateSelfwithresult success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_1100 END-------------"); + done(); + }); + }, 4000); + }); + /* + * @tc.number Singlehap_LifeCycleTest_1200 + * @tc.name Register listening in abilityA foreground,repeat the registration (standard) + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_1200", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1200 START-------------"); + TAG = "Singlehap_LifeCycleTest_1200"; + var id1; + var id2; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility8", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list8)); + console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid8)); + id1 = globalThis.callbackid8; + console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility8", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 2000); + setTimeout(function () { + console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list8)); + console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid8)); + id2 = globalThis.callbackid8; + console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); + expect(id1 + 1).assertEqual(id2); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid8, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + var para = { + resultCode: 1, + want: { + "abilityName": "MainAbility8", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); + globalThis.ability8.terminateSelfWithResult(para, (error, data) => { + console.log(TAG + " terminateSelfwithresult success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_1200 END-------------"); + done(); + }); + }, 4000); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1300 + * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (singleton) + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_1300", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1300 start-------------"); + TAG = "Singlehap_LifeCycleTest_1300"; + listKeyTemp = []; + abilityContext.startAbility({ + bundleName: "com.example.lifecycle_xts", + abilityName: "MainAbility9" + }, (error, data) => { + console.log(TAG + ": MainAbility9 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + await sleep(500); + abilityContext.startAbility({ + bundleName: "com.example.lifecycle_xts", + abilityName: "Hap1MainAbility1" + }, (error, data) => { + console.log(TAG + ":first Hap1MainAbility1 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + await sleep(500); + abilityContext.startAbility({ + bundleName: "com.example.lifecycle_xts", + abilityName: "Hap1MainAbility1" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap1MainAbility1 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for (var i = 0; i < globalThis.mainAbility9ListKey.length; i++) { + if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility1") { + listKeyTemp.push(globalThis.mainAbility9ListKey[i]); + } + } + console.log(TAG + "listKeyTemp is :" + listKeyTemp); + console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId); + expect(listKeyTemp[0]).assertEqual("Hap1MainAbility1 onAbilityCreate"); + expect(listKeyTemp[1]).assertEqual("Hap1MainAbility1 onAbilityWindowStageCreate"); + expect(listKeyTemp[2]).assertEqual("Hap1MainAbility1 onAbilityForeground"); + expect(listKeyTemp[3]).assertEqual("Hap1MainAbility1 onAbilityBackground"); + expect(listKeyTemp[4]).assertEqual("Hap1MainAbility1 onAbilityWindowStageDestroy"); + expect(listKeyTemp[5]).assertEqual("Hap1MainAbility1 onAbilityDestroy"); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + done(); + }); + }, 3000) + }); + console.log("------------Singlehap_LifeCycleTest_1300 end-------------"); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1400 + * @tc.name The ability of HAP A listens to the ability lifecycle callback of HAP B (standard) + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_1400", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1400 start-------------"); + TAG = "Singlehap_LifeCycleTest_1400"; + listKeyTemp = []; + abilityContext.startAbility({ + bundleName: "com.example.lifecycle_xts", + abilityName: "MainAbility9" + }, (error, data) => { + console.log(TAG + ": MainAbility9 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + await sleep(500); + abilityContext.startAbility({ + bundleName: "com.example.lifecycle_xts", + abilityName: "Hap1MainAbility2" + }, (error, data) => { + console.log(TAG + ":first Hap1MainAbility2 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + await sleep(500); + abilityContext.startAbility({ + bundleName: "com.example.lifecycle_xts", + abilityName: "Hap1MainAbility2" + }, (error, data) => { + setTimeout(() => { + console.log(TAG + ": second Hap1MainAbility2 startAbility success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + for (var i = 0;i < globalThis.mainAbility9ListKey.length; i++) { + if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility2") { + listKeyTemp.push(globalThis.mainAbility9ListKey[i]); + } + } + console.log(TAG + "listKeyTemp is :" + listKeyTemp); + console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId); + expect(listKeyTemp[0]).assertEqual("Hap1MainAbility2 onAbilityCreate"); + expect(listKeyTemp[1]).assertEqual("Hap1MainAbility2 onAbilityWindowStageCreate"); + expect(listKeyTemp[2]).assertEqual("Hap1MainAbility2 onAbilityForeground"); + expect(listKeyTemp[3]).assertEqual("Hap1MainAbility2 onAbilityCreate"); + expect(listKeyTemp[4]).assertEqual("Hap1MainAbility2 onAbilityWindowStageCreate"); + expect(listKeyTemp[5]).assertEqual("Hap1MainAbility2 onAbilityForeground"); + expect(listKeyTemp[6]).assertEqual("Hap1MainAbility2 onAbilityBackground"); + expect(listKeyTemp[7]).assertEqual("Hap1MainAbility2 onAbilityWindowStageDestroy"); + expect(listKeyTemp[8]).assertEqual("Hap1MainAbility2 onAbilityDestroy"); + expect(listKeyTemp[9]).assertEqual("Hap1MainAbility2 onAbilityBackground"); + expect(listKeyTemp[10]).assertEqual("Hap1MainAbility2 onAbilityWindowStageDestroy"); + expect(listKeyTemp[11]).assertEqual("Hap1MainAbility2 onAbilityDestroy"); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + done(); + }); + }, 3000) + }); + console.log("------------Singlehap_LifeCycleTest_1400 end-------------"); + }); + /* + * @tc.number Singlehap_LifeCycleTest_1500 + * @tc.name Register in abilityA , starting and termination AbilityB,Repeat previous steps (standard) + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_1500", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1500 START-------------"); + TAG = "Singlehap_LifeCycleTest_1500"; + var id1; + var id2; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility11", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list11)); + console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid11)); + id1 = globalThis.callbackid11; + console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility11", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 1000); + }, 3000); + setTimeout(function () { + console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list11)); + console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid11)); + id2 = globalThis.callbackid11; + console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list11.length; i++) { + strtemp = globalThis.list11[i].substring(0, 12); + if (strtemp == "MainAbility2") { + listtemp.push(globalThis.list11[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(id1 + 1).assertEqual(id2); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid11, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_1500 END-------------"); + done(); + }); + }, 6000); + }); + + var callbackid_NA = 100 + var callbackid_errorNum = -1 + var callbackid_errorType = "test" + /* + * @tc.number Singlehap_LifeCycleTest_1600 + * @tc.name input Nonexistent callbackid for unregisterAbilityLifecycleCallback parameter + * @tc.desc Function test + * @tc.level 1 + */ + it("Singlehap_LifeCycleTest_1600", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1600 START-------------"); + TAG = "Singlehap_LifeCycleTest_1600"; + let code; + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(callbackid_NA, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + sleep(1000); + expect(code).assertEqual(1); + done(); + }); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1700 + * @tc.name input error callbackid for unregisterAbilityLifecycleCallback parameter + * @tc.desc Function test + * @tc.level 1 + */ + it("Singlehap_LifeCycleTest_1700", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1700 START-------------"); + TAG = "Singlehap_LifeCycleTest_1700"; + let code; + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(callbackid_errorNum, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + sleep(1000); + expect(code).assertEqual(1); + done(); + }); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1800 + * @tc.name input error type callbackid for unregisterAbilityLifecycleCallback parameter + * @tc.desc Function test + * @tc.level 1 + */ + it("Singlehap_LifeCycleTest_1800", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1800 START-------------"); + TAG = "Singlehap_LifeCycleTest_1800"; + let code; + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(callbackid_errorType, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + sleep(1000); + expect(code).assertEqual(1); + done(); + }); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_1900 + * @tc.name input null callbackid for unregisterAbilityLifecycleCallback parameter + * @tc.desc Function test + * @tc.level 1 + */ + it("Singlehap_LifeCycleTest_1900", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_1900 START-------------"); + TAG = "Singlehap_LifeCycleTest_1900"; + let code; + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(null, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + code = error.code; + sleep(1000); + expect(code).assertEqual(1); + done(); + }); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_2000 + * @tc.name Register in abilityA, starting and termination AbilityB, terminate abilityA, Re-register in abilityA + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_2000", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_2000 START-------------"); + TAG = "Singlehap_LifeCycleTest_2000"; + var id1; + var id2; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility12", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + setTimeout(function () { + console.log(TAG + " firstCallback listKey : " + JSON.stringify(globalThis.list12)); + console.log(TAG + " firstCallback callbackid : " + JSON.stringify(globalThis.callbackid12)); + id1 = globalThis.callbackid12; + console.log(TAG + " firstCallback id : " + JSON.stringify(id1)); + var para = { + resultCode: 2000, + want: { + "abilityName": "MainAbility12", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); + globalThis.ability12.terminateSelfWithResult(para) + .then((data) => { + console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); + }); + }, 2500); + setTimeout(function () { + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility12", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + }, 4000); + setTimeout(function () { + console.log(TAG + " secondCallback listKey : " + JSON.stringify(globalThis.list12)); + console.log(TAG + " secondCallback callbackid : " + JSON.stringify(globalThis.callbackid12)); + id2 = globalThis.callbackid12; + console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < globalThis.list12.length; i++) { + strtemp = globalThis.list12[i].substring(0, 12); + if (strtemp == "MainAbility2") { + listtemp.push(globalThis.list12[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + let exlist = listtemp; + expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(id1 + 1).assertEqual(id2); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid6, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_2000 END-------------"); + done(); + }); + }, 6200); + }); + + /* + * @tc.number Singlehap_LifeCycleTest_2100 + * @tc.name Register in abilityA,register in abilityB, starting and termination abilityC, + termination abilityB、abilityA, Re-register in abilityA、abilityB + * @tc.desc Function test + * @tc.level 0 + */ + it("Singlehap_LifeCycleTest_2100", 0, async function (done) { + console.log("------------Singlehap_LifeCycleTest_2100 START-------------"); + TAG = "Singlehap_LifeCycleTest_2100"; + var id1; + var id2; + var id3; + var id4; + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility12", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str2 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str2) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + }, 500); + setTimeout(function () { + console.log(TAG + " firstCallback listKey1 : " + JSON.stringify(globalThis.list1)); + console.log(TAG + " firstCallback callbackid1 : " + JSON.stringify(globalThis.callbackid1)); + console.log(TAG + " firstCallback listKey12 : " + JSON.stringify(globalThis.list12)); + console.log(TAG + " firstCallback callbackid12 : " + JSON.stringify(globalThis.callbackid12)); + id1 = globalThis.callbackid1; + console.log(TAG + " firstCallback id1 : " + JSON.stringify(id1)); + id2 = globalThis.callbackid12; + console.log(TAG + " firstCallback id12 : " + JSON.stringify(id2)); + var para = { + resultCode: 2100, + want: { + "abilityName": "MainAbility12", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); + globalThis.ability12.terminateSelfWithResult(para) + .then((data) => { + console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); + }); + setTimeout(function () { + var para = { + resultCode: 2100, + want: { + "abilityName": "MainAbility1", + "bundleName": "com.example.lifecycle_xts" + } + } + console.log(TAG + " terminateSelfwithresult para: " + JSON.stringify(para)); + globalThis.ability1context.terminateSelfWithResult(para) + .then((data) => { + console.log(TAG + " terminateSelfwithresult successful data: " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error)); + }); + }, 500); + }, 3000); + setTimeout(function () { + var str = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility1", + } + globalThis.abilityContext.startAbility(str) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str1 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility12", + } + globalThis.abilityContext.startAbility(str1) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + setTimeout(function () { + var str2 = { + "bundleName": "com.example.lifecycle_xts", + "abilityName": "MainAbility2", + } + globalThis.abilityContext.startAbility(str2) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + }, 500); + }, 500); + }, 4000); + setTimeout(function () { + console.log(TAG + " secondCallback listKey1 : " + JSON.stringify(globalThis.list1)); + let templist1 = globalThis.list1; + console.log(TAG + " secondCallback templist1 : " + JSON.stringify(templist1)); + console.log(TAG + " secondCallback callbackid1 : " + JSON.stringify(globalThis.callbackid1)); + console.log(TAG + " secondCallback listKey12 : " + JSON.stringify(globalThis.list12)); + let templist2 = globalThis.list12; + console.log(TAG + " secondCallback templist2 : " + JSON.stringify(templist2)); + console.log(TAG + " secondCallback callbackid12 : " + JSON.stringify(globalThis.callbackid12)); + id3 = globalThis.callbackid1; + console.log(TAG + " secondCallback id1 : " + JSON.stringify(id3)); + id4 = globalThis.callbackid12; + console.log(TAG + " secondCallback id12 : " + JSON.stringify(id4)); + var strtemp = ""; + var listtemp = []; + for (var i = 0; i < templist1.length; i++) { + strtemp = templist1[i].substring(0, 13); + if (strtemp === "MainAbility2 " || strtemp === "MainAbility12") { + listtemp.push(templist1[i]); + } + } + console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + setTimeout(function () { + var strtemp1 = ""; + var listtemp1 = []; + for (var j = 0; j < templist2.length; j++) { + strtemp1 = templist2[j].substring(0, 12); + if (strtemp1 === "MainAbility2") { + listtemp1.push(templist2[j]); + } + } + console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1)); + let exlist = listtemp; + let exlist1 = listtemp1; + expect(exlist[0]).assertEqual("MainAbility12 onAbilityCreate"); + expect(exlist[1]).assertEqual("MainAbility12 onAbilityWindowStageCreate"); + expect(exlist[2]).assertEqual("MainAbility12 onAbilityForeground"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[6]).assertEqual("MainAbility12 onAbilityBackground"); + expect(exlist[7]).assertEqual("MainAbility12 onAbilityForeground"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[9]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist[10]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(exlist1[0]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist1[1]).assertEqual("MainAbility2 onAbilityWindowStageCreate"); + expect(exlist1[2]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist1[3]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist1[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy"); + expect(exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(id1 + 1).assertEqual(id2); + expect(id3 + 1).assertEqual(id4); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid12, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + }); + abilityContext.getApplicationContext() + .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { + console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + + ",data: " + JSON.stringify(data)); + console.log("------------Singlehap_LifeCycleTest_2100 END-------------"); + done(); + }); + }, 100); + }, 7000); + }); + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..becdd6d36bab6b61d759ca29560397d72aca99e2 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets @@ -0,0 +1,19 @@ +/* + * 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 LifeCycleTest from './LifeCycleTest' + +export default function List(context) { + LifeCycleTest(context) +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2dc9bfeff959762fcee6c82acef4e8cbbdaa7213 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json @@ -0,0 +1,136 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.lifecycle_xts.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" + ] + }] + }, + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label" + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + }, + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", + "description": "$string:MainAbility4_desc", + "icon": "$media:icon", + "label": "$string:MainAbility4_label" + }, + { + "name": "MainAbility5", + "srcEntrance": "./ets/MainAbility5/MainAbility5.ts", + "description": "$string:MainAbility5_desc", + "icon": "$media:icon", + "label": "$string:MainAbility5_label" + }, + { + "name": "MainAbility6", + "srcEntrance": "./ets/MainAbility6/MainAbility6.ts", + "description": "$string:MainAbility6_desc", + "icon": "$media:icon", + "label": "$string:MainAbility6_label" + }, + { + "name": "MainAbility7", + "srcEntrance": "./ets/MainAbility7/MainAbility7.ts", + "description": "$string:MainAbility7_desc", + "launchType": "singleton", + "icon": "$media:icon", + "label": "$string:MainAbility7_label" + }, + { + "name": "MainAbility8", + "srcEntrance": "./ets/MainAbility8/MainAbility8.ts", + "description": "$string:MainAbility8_desc", + "launchType": "standard", + "icon": "$media:icon", + "label": "$string:MainAbility8_label" + }, + { + "name": "MainAbility9", + "srcEntrance": "./ets/MainAbility9/MainAbility9.ts", + "description": "$string:MainAbility9_desc", + "icon": "$media:icon", + "label": "$string:MainAbility9_label" + }, + { + "name": "Hap1MainAbility1", + "srcEntrance": "./ets/Hap1MainAbility1/Hap1MainAbility1.ts", + "description": "$string:Hap1MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:Hap1MainAbility1_label", + "launchType": "singleton" + }, + { + "name": "Hap1MainAbility2", + "srcEntrance": "./ets/Hap1MainAbility2/Hap1MainAbility2.ts", + "description": "$string:Hap1MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:Hap1MainAbility2_label", + "launchType": "standard" + }, + { + "name": "MainAbility10", + "srcEntrance": "./ets/MainAbility10/MainAbility10.ts", + "description": "$string:MainAbility10_desc", + "icon": "$media:icon", + "label": "$string:MainAbility10_label" + }, + { + "name": "MainAbility11", + "srcEntrance": "./ets/MainAbility11/MainAbility11.ts", + "description": "$string:MainAbility11_desc", + "icon": "$media:icon", + "label": "$string:MainAbility11_label", + "launchType": "standard" + }, + { + "name": "MainAbility12", + "srcEntrance": "./ets/MainAbility12/MainAbility12.ts", + "description": "$string:MainAbility12_desc", + "icon": "$media:icon", + "label": "$string:MainAbility12_label" + }] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76d7bab092739497410659661f1b743680e0fd66 --- /dev/null +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,160 @@ +{ + "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": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "MainAbility4_desc", + "value": "description" + }, + { + "name": "MainAbility4_label", + "value": "label" + }, + { + "name": "MainAbility5_desc", + "value": "description" + }, + { + "name": "MainAbility5_label", + "value": "label" + }, + { + "name": "MainAbility6_desc", + "value": "description" + }, + { + "name": "MainAbility6_label", + "value": "label" + }, + { + "name": "MainAbility7_desc", + "value": "description" + }, + { + "name": "MainAbility7_label", + "value": "label" + }, + { + "name": "MainAbility8_desc", + "value": "description" + }, + { + "name": "MainAbility8_label", + "value": "label" + }, + { + "name": "MainAbility9_desc", + "value": "description" + }, + { + "name": "MainAbility9_label", + "value": "label" + }, + { + "name": "Hap1MainAbility1_desc", + "value": "description" + }, + { + "name": "Hap1MainAbility1_label", + "value": "label" + }, + { + "name": "Hap1MainAbility2_desc", + "value": "description" + }, + { + "name": "Hap1MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility10_desc", + "value": "description" + }, + { + "name": "MainAbility10_label", + "value": "label" + }, + { + "name": "MainAbility11_desc", + "value": "description" + }, + { + "name": "MainAbility11_label", + "value": "label" + }, + { + "name": "MainAbility12_desc", + "value": "description" + }, + { + "name": "MainAbility12_label", + "value": "label" + }, + { + "name": "MainAbility13_desc", + "value": "description" + }, + { + "name": "MainAbility13_label", + "value": "label" + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/profile/main_pages.json rename to ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/resources/base/profile/main_pages.json diff --git a/aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/signature/openharmony_sx.p7b b/ability/ability_runtime/stage/actslifecyclesinglehaptest/signature/openharmony_sx.p7b similarity index 100% rename from aafwk/aafwk_standard/stage/actslifecyclesinglehaptest/signature/openharmony_sx.p7b rename to ability/ability_runtime/stage/actslifecyclesinglehaptest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/want/BUILD.gn b/ability/ability_runtime/want/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/want/BUILD.gn rename to ability/ability_runtime/want/BUILD.gn diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/BUILD.gn b/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/BUILD.gn rename to ability/ability_runtime/want/actsgetwantalltest/BUILD.gn diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/Test.json b/ability/ability_runtime/want/actsgetwantalltest/Test.json similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/Test.json rename to ability/ability_runtime/want/actsgetwantalltest/Test.json diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/config.json b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/config.json rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/config.json diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/app.js b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/ability/ability_runtime/want/actsgetwantalltest/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/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63 --- /dev/null +++ b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/media/icon.png diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js new file mode 100644 index 0000000000000000000000000000000000000000..a5163aa63f6f50f3da2263d2cd4d4d052463b2b4 --- /dev/null +++ b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js @@ -0,0 +1,1425 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import wantConstant from '@ohos.ability.wantConstant' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsGetWantTest', function () { + beforeAll(async (done) => { + console.info('ActsGetWantTest begin') + done(); + }) + + var TIMEOUT_NUMBER = 2500; + + // @tc.number: ACTS_GetWant_0100 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_0100', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + parameters: + { + mykey0: 1, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmony"], + }, + } + }).then((data) => { + console.info('====> ACTS_GetWant_0100 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.parameters.mykey0).assertEqual(1); + expect(data.want.parameters.mykey1[0]).assertEqual(1); + expect(data.want.parameters.mykey1[1]).assertEqual(2); + expect(data.want.parameters.mykey1[2]).assertEqual(3); + expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_0100 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + // @tc.number: ACTS_GetWant_0200 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_0200', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + parameters: + { + mykey0: 1, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmony"], + }, + } + }, + (err, data) => { + console.info('====> ACTS_GetWant_0200 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.parameters.mykey0).assertEqual(1); + expect(data.want.parameters.mykey1[0]).assertEqual(1); + expect(data.want.parameters.mykey1[1]).assertEqual(2); + expect(data.want.parameters.mykey1[2]).assertEqual(3); + expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + // @tc.number: ACTS_GetWant_0300 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_0300', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action2", + entities: ["entity1", "entity2"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.3], + mykey2: "[1, 2, 3]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "!@#$%", "helloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult0300(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_0300 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + function checkOnAbilityResult0300(data) { + console.info('====> ACTS_GetWant_0300 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action2"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.entities[1]).assertEqual("entity2"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.3); + expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); + console.info('====> ACTS_GetWant_0300 before done=====>') + } + + // @tc.number: ACTS_GetWant_0500 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_0500', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + console.info('====> ACTS_GetWant_0500 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_0500 before done=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_0500 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + // @tc.number: ACTS_GetWant_0600 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_0600', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + console.info('====> ACTS_GetWant_0600 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_0600 before done=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + // @tc.number: ACTS_GetWant_0700 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_0700', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + console.info('====> ACTS_GetWant_0700 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_0700 before done=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_0700 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + // @tc.number: ACTS_GetWant_0800 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_0800', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + checkOnAbilityResult0800(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + function checkOnAbilityResult0800(data) { + console.info('====> ACTS_GetWant_0800 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_0800 before done=====>') + } + + // @tc.number: ACTS_GetWant_0900 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_0900', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + console.info('====> ACTS_GetWant_0900 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_0900 before done=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_0900 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + // @tc.number: ACTS_GetWant_1000 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_1000', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + checkOnAbilityResult1000(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + function checkOnAbilityResult1000(data) { + console.info('====> ACTS_GetWant_1000 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1000 before done=====>') + } + + // @tc.number: ACTS_GetWant_1100 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_1100', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult1100(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_1100 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + function checkOnAbilityResult1100(data) { + console.info('====> ACTS_GetWant_1100 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1100 before done=====>') + } + + // @tc.number: ACTS_GetWant_1200 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_1200', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + console.info('====> ACTS_GetWant_1200 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1200 before done=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + // @tc.number: ACTS_GetWant_1300 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_1300', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + console.info('====> ACTS_GetWant_1300 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1300 before done=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_1300 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + // @tc.number: ACTS_GetWant_1400 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_1400', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + checkOnAbilityResult1400(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + function checkOnAbilityResult1400(data) { + console.info('====> ACTS_GetWant_1400 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1400 before done=====>') + } + + // @tc.number: ACTS_GetWant_1500 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_1500', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult1500(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_1500 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + function checkOnAbilityResult1500(data) { + console.info('====> ACTS_GetWant_1500 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE ); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1500 setTimeout before done.=====>') + } + + // @tc.number: ACTS_GetWant_1600 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_1600', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + console.info('====> ACTS_GetWant_1600 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE ); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1600 setTimeout before done.=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + // @tc.number: ACTS_GetWant_1700 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_1700', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + console.info('====> ACTS_GetWant_1700 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY ); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1700 setTimeout before done.=====>') + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_1700 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + // @tc.number: ACTS_GetWant_1900 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_1900', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult1900(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_1900 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + function checkOnAbilityResult1900(data) { + console.info('====> ACTS_GetWant_1900 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_1900 setTimeout before done.=====>') + } + + // @tc.number: ACTS_GetWant_2100 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_2100', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult2100(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_2100 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + function checkOnAbilityResult2100(data) { + console.info('====> ACTS_GetWant_2100 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_2100 setTimeout before done.=====>') + } + + // @tc.number: ACTS_GetWant_2200 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_2200', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + checkOnAbilityResult2200(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + function checkOnAbilityResult2200(data) { + console.info('====> ACTS_GetWant_2200 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_2200 setTimeout before done.=====>') + } + + // @tc.number: ACTS_GetWant_2300 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by promise) + it('ACTS_GetWant_2300', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult2300(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_2300 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }) + + function checkOnAbilityResult2300(data) { + console.info('====> ACTS_GetWant_2300 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_2300 setTimeout before done.=====>') + } + + // @tc.number: ACTS_GetWant_2400 + // @tc.name: getWant : get want in current ability + // @tc.desc:Start the ability through startabilityforresult, + // and then use terminateselfwithresult to return the data (by callback) + it('ACTS_GetWant_2400', 0, async function (done) { + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.0000000003], + mykey2: "[a, b, c]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], + }, + }, + }, + (err, data) => { + checkOnAbilityResult2400(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }) + + function checkOnAbilityResult2400(data) { + console.info('====> ACTS_GetWant_2400 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action1"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); + expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("STR"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); + console.info('====> ACTS_GetWant_2400 setTimeout before done.=====>') + } + + /* + * @tc.number ACTS_GetWant_2500 + * @tc.name Misconfigured bundlename validation + * @tc.desc Function test (by promise) + * @tc.level 0 + */ + it("ACTS_GetWant_2500",0, async function(done){ + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action2", + entities: ["entity1", "entity2"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.3], + mykey2: "[1, 2, 3]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "test123", "helloopenharmony"], + }, + }, + }).then((data) => { + checkOnAbilityResult2500(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }).catch((error) => { + console.log('ACTS_GetWant_2500 error: ' + JSON.stringify(error)) + expect.assertFail() + done(); + }) + }); + + function checkOnAbilityResult2500(data) { + console.info('====> ACTS_GetWant_2500 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action2"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT ); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.3); + expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("test123"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); + console.info('====> ACTS_GetWant_2500 before done=====>') + } + + /* + * @tc.number ACTS_GetWant_2600 + * @tc.name Misconfigured bundlename validation + * @tc.desc Function test (by callback) + * @tc.level 0 + */ + it("ACTS_GetWant_2600",0, async function(done){ + featureAbility.startAbilityForResult({ + want: + { + deviceId: "", + bundleName: "com.example.actsgetwantalltesthap", + abilityName: "com.example.actsgetwantalltesthap.MainAbility", + action: "action2", + entities: ["entity1", "entity2"], + type: "MIMETYPE", + uri: "key={true,true,false}", + flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, + parameters: + { + mykey0: 0.1, + mykey1: [0.1, 0.2, 0.3], + mykey2: "[1, 2, 3]", + mykey3: "str", + mykey4: [false, true, false], + mykey5: ["str", "test123", "helloopenharmony"], + }, + }, + }, + (err, data) => { + checkOnAbilityResult2600(data); + setTimeout(()=>{ + done(); + }, TIMEOUT_NUMBER); + }) + }); + + function checkOnAbilityResult2600(data) { + console.info('====> ACTS_GetWant_2600 start ability=====>' + JSON.stringify(data)) + expect(data.want.deviceId).assertEqual(""); + expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); + expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); + expect(data.want.action).assertEqual("action2"); + expect(data.want.entities[0]).assertEqual("entity1"); + expect(data.want.type).assertEqual("MIMETYPE"); + expect(data.want.uri).assertEqual("key={true,true,false}"); + expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT ); + expect(data.want.parameters.mykey0).assertEqual(0.1); + expect(data.want.parameters.mykey1[0]).assertEqual(0.1); + expect(data.want.parameters.mykey1[1]).assertEqual(0.2); + expect(data.want.parameters.mykey1[2]).assertEqual(0.3); + expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.want.parameters.mykey3).assertEqual("str"); + expect(data.want.parameters.mykey4[0]).assertEqual(false); + expect(data.want.parameters.mykey4[1]).assertEqual(true); + expect(data.want.parameters.mykey4[2]).assertEqual(false); + expect(data.want.parameters.mykey5[0]).assertEqual("str"); + expect(data.want.parameters.mykey5[1]).assertEqual("test123"); + expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); + console.info('====> ACTS_GetWant_2600 before done=====>') + } + + /** + * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0100 + * @tc.name: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant. + * @tc.desc: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant. + */ + it('SUB_AA_OpenHarmony_wantConstantEnumeration_0100',0, async function (done) { + console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- start") + let image = wantConstant.Action.ACTION_IMAGE_CAPTURE + expect(image).assertEqual("ohos.want.action.imageCapture") + console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- end") + done() + }) + + /** + * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0200 + * @tc.name: Check the enumerated value ACTION_VIDEO_CAPTURE of wantConstant. + * @tc.desc: Check the enumerated value ACTION_VIDEO_CAPTURE of wantCconstant. + */ + it('SUB_AA_OpenHarmony_wantConstantEnumeration_0200',0, async function (done) { + console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- start") + let video = wantConstant.Action.ACTION_VIDEO_CAPTURE + expect(video).assertEqual("ohos.want.action.videoCapture") + console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- end") + done() + }) + + /** + * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0300 + * @tc.name: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant. + * @tc.desc: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant. + */ + it('SUB_AA_OpenHarmony_wantConstantEnumeration_0300',0, async function (done) { + console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- start") + let app = wantConstant.Action.ACTION_APP_ACCOUNT_OAUTH + expect(app).assertEqual("ohos.account.appAccount.action.oauth") + console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- end") + done() + }) +}) diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/List.test.js b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b09ec7c7b7f982f7f0d834f5c03b9544bea2736f --- /dev/null +++ b/ability/ability_runtime/want/actsgetwantalltest/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('./ActsGetWantAllTest.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/signature/openharmony_sx.p7b b/ability/ability_runtime/want/actsgetwantalltest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/signature/openharmony_sx.p7b rename to ability/ability_runtime/want/actsgetwantalltest/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/BUILD.gn b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/BUILD.gn similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/BUILD.gn rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/BUILD.gn diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/signature/openharmony_sx.p7b b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/signature/openharmony_sx.p7b rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/signature/openharmony_sx.p7b diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/config.json b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/config.json rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json diff --git a/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/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/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/en-US.json similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/en-US.json diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/i18n/zh-CN.json diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.css b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.css similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.css diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.hml similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.hml diff --git a/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.js b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.js old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.js diff --git a/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/element/string.json b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2f9470d82c49675a64972657d8d367cd95e51c63 --- /dev/null +++ b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/media/icon.png diff --git a/aafwk/aafwk_standard/zidltest/BUILD.gn b/ability/ability_runtime/zidltest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/BUILD.gn rename to ability/ability_runtime/zidltest/BUILD.gn diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/AppScope/app.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/AppScope/app.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/AppScope/app.json rename to ability/ability_runtime/zidltest/actsamszidlclienttest/AppScope/app.json diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/AppScope/resources/base/element/string.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/AppScope/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/AppScope/resources/base/element/string.json rename to ability/ability_runtime/zidltest/actsamszidlclienttest/AppScope/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/zidltest/actsamszidlclienttest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/zidltest/actsamszidlclienttest/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/BUILD.gn b/ability/ability_runtime/zidltest/actsamszidlclienttest/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/BUILD.gn rename to ability/ability_runtime/zidltest/actsamszidlclienttest/BUILD.gn diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/Test.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..dd53882afeddf9397989f323c34a867f69d4fd7a --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/Test.json @@ -0,0 +1,31 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.zidlclienttest", + "shell-timeout": "300000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsZidlClientTest.hap", + "ActsAmsZidlServiceRelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/Application/AbilityStage.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/Application/AbilityStage.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/Application/AbilityStage.ts diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/MainAbility/MainAbility.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/MainAbility/MainAbility.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b18b7c147cd0cc232b5779698c1c264bc7f717e --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,434 @@ +/* +* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility'; +import Want from '@ohos.application.Want'; +import {voidOutStringCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOutIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutStringCallback} from "./zidlTool/i_zidl_tool_test"; +import {booleanVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {byteVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {shortVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {intVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {longVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {floatVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {doubleVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {stringVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {sequenceableVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {interfaceVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {mapStringStringVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {doubleArrayVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOrderOutInCallback} from "./zidlTool/i_zidl_tool_test" +import {voidOrderInOutInCallback} from "./zidlTool/i_zidl_tool_test" +import {voidOrderOutInOutCallback} from "./zidlTool/i_zidl_tool_test" +import {voidOrderInInOutOutCallback} from "./zidlTool/i_zidl_tool_test" +import {onewayVoidVoidCallback} from "./zidlTool/i_zidl_tool_test" +import {voidInMapStringIntCallback} from "./zidlTool/i_zidl_tool_test" +import {voidVoidCallback} from "./zidlTool/i_zidl_tool_test" +import {voidInStringArrayCallback} from "./zidlTool/i_zidl_tool_test" +import ZidlTestServiceStub from './zidlTool/zidl_tool_test_stub'; +import MySequenceable from "./zidlTool/my_sequenceable"; +import InterfaceDeclareProxy from './interfaceDeclare/interface_declare_proxy' +import InterfaceDeclareStub from './interfaceDeclare/interface_declare_stub' +import {voidInIntCallback} from "./zidlTool/i_zidl_tool_test" +import {voidInStringCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeBooleanCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeByteCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeShortCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeIntCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeLongCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeFloatCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeDoubleCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeStringCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeSequenceableCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeInterfaceCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeMapStringStringCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeDoubleArrayCallback} from "./zidlTool/i_zidl_tool_test" +import {testInterfaceCallback} from './interfaceDeclare/i_interface_declare' + +var SUCCESS = 0; +var FAIL = 1; + +class ZidlTestImp extends ZidlTestServiceStub { + + onewayVoidVoid(callback: onewayVoidVoidCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0200 called"); + callback(SUCCESS); + } + + voidVoid(callback: voidVoidCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0300 called"); + callback(SUCCESS); + } + + booleanVoid(callback: booleanVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0400 called"); + var boolean = true; + callback(SUCCESS, boolean); + } + + byteVoid(callback: byteVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0500 called"); + var mybyte = 1; + callback(SUCCESS, mybyte); + } + + shortVoid(callback: shortVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0600 called"); + var myshort = 222; + callback(SUCCESS, myshort); + } + + intVoid(callback: intVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0700 called"); + var myint = 333; + callback(SUCCESS, myint); + } + + longVoid(callback: longVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0800 called"); + var mylong = 4444; + callback(SUCCESS, mylong); + } + + floatVoid(callback: floatVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0900 called"); + var myfloat = 10.1; + callback(SUCCESS, myfloat); + } + + doubleVoid(callback: doubleVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1000 called"); + var mydouble = 22.1; + callback(SUCCESS, mydouble); + } + + stringVoid(callback: stringVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1100 called"); + var mystring = "stringVoid"; + callback(SUCCESS, mystring); + } + + sequenceableVoid(callback: sequenceableVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1200 called"); + let mySequence = new MySequenceable(); + callback(SUCCESS, mySequence); + } + + interfaceVoid(callback: interfaceVoidCallback) { + class InterfaceDeclare extends InterfaceDeclareStub { + testInterface(data: number, callback: testInterfaceCallback): void{ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1300 interfaceStub called"); + let result = FAIL; + + if (data == 1500) { + result = SUCCESS; + } + callback(result); + } + } + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1300 toolStub called"); + let serverInterface = new InterfaceDeclare('serverInterface'); + callback(SUCCESS, serverInterface); + } + + mapStringStringVoid(callback: mapStringStringVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1400 called"); + let myMap = new Map(); + myMap.set("string1","string2"); + callback(SUCCESS, myMap); + } + + doubleArrayVoid(callback: doubleArrayVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1500 called"); + var array = [1.1, 2.1, 3.1]; + callback(SUCCESS, array); + } + + voidInMapStringInt(myMap, callback: voidInMapStringIntCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1600_1 called:'+ myMap.get("string1")); + if(myMap.get("string1") == 1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidInStringArray(strarray, callback: voidInStringArrayCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_1600_2 called:"+ JSON.stringify(strarray)); + if(strarray[0] == "aaa"&&strarray[1] == "bbb"&&strarray[2] == "ccc"){ + callback(SUCCESS); + }else { + callback(FAIL); + } + } + + voidOutMapStringInt(callback : voidOutMapStringIntCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1700 called'); + var map=new Map(); + map.set("voidOutMapStringInt", 1); + callback(SUCCESS, map); + } + + voidOutStringArray(callback :voidOutStringArrayCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1700 called'); + var strarray = ["aa", "dd"]; + callback(SUCCESS, strarray); + } + + voidInOutMapStringInt(mapIn, callback: voidInOutMapStringIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1800 called'); + var errCode = FAIL; + if ((mapIn.get("voidInOutMapStringInt1") == 1801) && + (mapIn.get("voidInOutMapStringInt2") == 1802)) { + mapIn.set("voidInOutMapStringInt1", 1802); + mapIn.set("voidInOutMapStringInt2", 1801); + errCode = SUCCESS; + } + callback(errCode, mapIn); + } + + voidInOutStringArray(strArrayIn, callback: voidInOutStringArrayCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1800 called'); + var errCode = FAIL; + if ((strArrayIn[0] == "ddd") && + (strArrayIn[1] == "ccc")) { + strArrayIn[0] = "aaa"; + strArrayIn[1] = "bbb"; + errCode = SUCCESS; + } + callback(errCode, strArrayIn); + } + + voidInInt(number, callback : voidInIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1900 called:'+ JSON.stringify(number)); + if(number == 8888){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidInString(string, callback : voidInStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_1900 called:'+ JSON.stringify(string)); + if(string == "voidInString"){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidOutInt(callback : voidOutIntCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2000 called'); + var number = 123; + callback(SUCCESS, number); + } + + voidOutString(callback : voidOutStringCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2000 called'); + var string = "voidOutString"; + callback(SUCCESS, string); + } + + voidInOutInt(number, callback: voidInOutIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_1 called:'+ JSON.stringify(number)); + var num = 456789; + if(number == 123456){ + callback(SUCCESS, num); + }else{ + callback(FAIL, number); + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_1 Call_Fail') + } + } + voidInOutString(strinput, callback: voidInOutStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_2 called:'+ JSON.stringify(strinput)); + var str = "456789"; + if(strinput == "voidInOutString"){ + callback(SUCCESS, str); + }else{ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2100_2 Call_Fail'); + callback(FAIL, strinput); + } + } + + voidParameterTypeBoolean(oBooleanTrue, callback : voidParameterTypeBooleanCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2200 called:'+ JSON.stringify(oBooleanTrue)); + if(oBooleanTrue == true){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeByte(number, callback : voidParameterTypeByteCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2300 called:'+ JSON.stringify(number)); + if(number == 1111){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeShort(number, callback : voidParameterTypeShortCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2400 called:'+ JSON.stringify(number)); + if(number == 2222){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeInt(number, callback : voidParameterTypeIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2500 called:'+ JSON.stringify(number)); + if(number == 3333){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeLong(number, callback : voidParameterTypeLongCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2600 called:'+ JSON.stringify(number)); + if(number == 4444){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeFloat(number, callback : voidParameterTypeFloatCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2700 called:'+ JSON.stringify(number)); + if(number == 5555.1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeDouble(number, callback : voidParameterTypeDoubleCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2800 called:'+ JSON.stringify(number)); + if(number == 6666.1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeString(string, callback : voidParameterTypeStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_2900 called:'+ JSON.stringify(string)); + if(string == "voidParameterTypeString"){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeSequenceable(MySequenceable, callback : voidParameterTypeSequenceableCallback) { + console.log('ZidlTest Process Server ACTS_Zidl_Js2JsSingle_3000 called:'+ JSON.stringify(MySequenceable)); + if((MySequenceable != null) && (MySequenceable.getNum() == 32) && (MySequenceable.getString() == "nihao")){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeInterface(param: InterfaceDeclareProxy, callback : voidParameterTypeInterfaceCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3100 called"); + let proxy = new InterfaceDeclareProxy(param); + proxy.testInterface(3300, (errCode)=>{ + if (errCode == SUCCESS) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3100 callback SUCCESS"); + callback(SUCCESS); + } else { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3100 callback FAIL"); + callback(FAIL); + } + }); + + } + + voidParameterTypeMapStringString(map, callback : voidParameterTypeMapStringStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_3200 called:'+ map.get("voidParameterTypeMapStringString")); + if(map.get("voidParameterTypeMapStringString") == "fdhatdh"){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeDoubleArray(array, callback : voidParameterTypeDoubleArrayCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsSingle_3300 called:'+ JSON.stringify(array)); + if(array.length == 2 && array[0] == 1.1 && array[1] == 2.1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidOrderOutIn(paramI, callback: voidOrderOutInCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3400 called" + paramI); + var mystring = "hello world"; + callback(SUCCESS, mystring); + } + + voidOrderInOutIn(paramI, paramS, callback: voidOrderInOutInCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3500 called" + paramI + " " + paramS); + var mynumber = 6; + callback(SUCCESS, mynumber); + } + + voidOrderOutInOut(paramS, callback: voidOrderOutInOutCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3600 called" + paramS); + var mynumber = 3; + var mystring = "paramcallback"; + callback(SUCCESS, mynumber, mystring); + } + + voidOrderInInOutOut(paramS, paramI, callback: voidOrderInInOutOutCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_3700 called" + paramS + " " + paramI); + var mystring = "callback"; + var mynumber = 4; + callback(SUCCESS, mynumber, mystring); + } +} + +export default class ServiceAbility extends ServiceExtension { + onCreate(want: Want) { + globalThis.abilityWant = want; + console.log('ZidlClientTest ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ZidlClientTest ServiceAbility onRequest, want: ' + want.abilityName + + ', startId: ' + startId); + } + + onConnect(want) { + console.log('ZidlClientTest ServiceAbility onConnect, want:' + want.abilityName); + return new ZidlTestImp('connect'); + } + + onDisconnect(want) { + console.log('ZidlClientTest ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ZidlClientTest ServiceAbility onDestroy'); + } +}; diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9469ce4d7e1d4fbd3ec452076ab8121b8b8adf7 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts @@ -0,0 +1,21 @@ +/* + * 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 interface IInterfaceDeclare { + testInterface(data: number, callback: testInterfaceCallback): void; +} +export type testInterfaceCallback = (errCode: number) => void; + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f9cc9c43d3b15599f88aa223e7308c43b997e60 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {testInterfaceCallback} from "./i_interface_declare"; +import IInterfaceDeclare from "./i_interface_declare"; +import rpc from "@ohos.rpc"; + +export default class InterfaceDeclareProxy implements IInterfaceDeclare { + constructor(proxy) { + this.proxy = proxy; + } + + testInterface(data: number, callback: testInterfaceCallback): void + { + let _option = new rpc.MessageOption(rpc.MessageOption.TF_SYNC); + let _data = new rpc.MessageParcel(); + let _reply = new rpc.MessageParcel(); + _data.writeInt(data); + this.proxy.sendRequest(InterfaceDeclareProxy.COMMAND_TEST_INTERFACE, _data, _reply, _option).then(function(result) { + if (result.errCode === 0) { + let _errCode = result.reply.readInt(); + callback(_errCode); + } else { + console.log("sendRequest failed, errCode: " + result.errCode); + } + }) + } + + static readonly COMMAND_TEST_INTERFACE = 1; + private proxy +} + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts new file mode 100644 index 0000000000000000000000000000000000000000..1606f77b4c0390be639f06cb093ee672cf05d478 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts @@ -0,0 +1,47 @@ +/* + * 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 {testInterfaceCallback} from "./i_interface_declare"; +import IInterfaceDeclare from "./i_interface_declare"; +import rpc from "@ohos.rpc"; + +export default class InterfaceDeclareStub extends rpc.RemoteObject implements IInterfaceDeclare { + constructor(des: string) { + super(des); + } + + onRemoteRequest(code: number, data, reply, option): boolean { + console.log("onRemoteRequest called, code = " + code); + switch(code) { + case InterfaceDeclareStub.COMMAND_TEST_INTERFACE: { + let _data = data.readInt(); + this.testInterface(_data, (errCode) => { + reply.writeInt(errCode); + }); + return true; + } + default: { + console.log("invalid request code" + code); + break; + } + } + return false; + } + + testInterface(data: number, callback: testInterfaceCallback): void{} + + static readonly COMMAND_TEST_INTERFACE = 1; +} + diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/service.ts diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts new file mode 100644 index 0000000000000000000000000000000000000000..bef9dcbe25c82b2c96e8ac8cc6493ce3d080baf6 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts @@ -0,0 +1,28 @@ +export default class MySequenceable { + constructor() { + this.num = 14; + this.str = "hello"; + } + getNum() : number { + return this.num; + } + + getString() : string { + return this.str; + } + + marshalling(messageParcel) { + console.info('marshalling++++'); + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + return true; + } + unmarshalling(messageParcel) { + console.info('unmarshalling++++'); + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + return true; + } + private num; + private str; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b236a48835edbe2729e8ce7ea7b5f06b769d236 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,65 @@ +/* +* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility'; +import Want from '@ohos.application.Want'; +import ZidlTestServiceStubOneway from './zidlToolOneWay/interface_attribute_declaratoin_oneway_stub'; +import {voidVoidFirstCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' +import {voidVoidSecondCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' +import {voidVoidThirdCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' + +const SUCCESS = 0; +const FAIL = 1; + +class ZidlTestImpOneway extends ZidlTestServiceStubOneway { + voidVoidFirst(callback: voidVoidFirstCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0100_1 called"); + callback(SUCCESS); + } + + voidVoidSecond(callback: voidVoidSecondCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0100_2 called"); + callback(SUCCESS); + } + + voidVoidThird(callback: voidVoidThirdCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsSingle_0100_3 called"); + callback(SUCCESS); + } +} + +export default class ServiceAbility2 extends ServiceExtension { + onCreate(want: Want) { + globalThis.abilityWant = want; + console.log('ZidlClientTest ServiceAbility2 onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ZidlClientTest ServiceAbility2 onRequest, want: ' + want.abilityName + + ', startId: ' + startId); + } + + onConnect(want) { + console.log('ZidlClientTest ServiceAbility2 onConnect, want:' + want.abilityName); + return new ZidlTestImpOneway('connect'); + } + + onDisconnect(want) { + console.log('ZidlClientTest ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ZidlClientTest ServiceAbility2 onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts new file mode 100644 index 0000000000000000000000000000000000000000..a17db0f5d20ac1d674258b1e094355c2276fc2b4 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export default interface IInterfaceAttributeDeclaratoinOneway { + voidVoidFirst(callback: voidVoidFirstCallback): void; + voidVoidSecond(callback: voidVoidSecondCallback): void; + voidVoidThird(callback: voidVoidThirdCallback): void; +} +export type voidVoidFirstCallback = (errCode: number) => void; +export type voidVoidSecondCallback = (errCode: number) => void; +export type voidVoidThirdCallback = (errCode: number) => void; + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts new file mode 100644 index 0000000000000000000000000000000000000000..016f352bd6d609916ad6e3b12e63e075a6fbe490 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {voidVoidFirstCallback} from "./i_interface_attribute_declaratoin_oneway"; +import {voidVoidSecondCallback} from "./i_interface_attribute_declaratoin_oneway"; +import {voidVoidThirdCallback} from "./i_interface_attribute_declaratoin_oneway"; +import IInterfaceAttributeDeclaratoinOneway from "./i_interface_attribute_declaratoin_oneway"; +import rpc from "@ohos.rpc"; + +export default class InterfaceAttributeDeclaratoinOnewayStub extends rpc.RemoteObject implements IInterfaceAttributeDeclaratoinOneway { + constructor(des: string) { + super(des); + } + + onRemoteRequest(code: number, data, reply, option): boolean { + console.log("onRemoteRequest called, code = " + code); + switch(code) { + case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_FIRST: { + this.voidVoidFirst((errCode) => { + reply.writeInt(errCode); + }); + return true; + } + case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_SECOND: { + this.voidVoidSecond((errCode) => { + reply.writeInt(errCode); + }); + return true; + } + case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_THIRD: { + this.voidVoidThird((errCode) => { + reply.writeInt(errCode); + }); + return true; + } + default: { + console.log("invalid request code" + code); + break; + } + } + return false; + } + + voidVoidFirst(callback: voidVoidFirstCallback): void{} + voidVoidSecond(callback: voidVoidSecondCallback): void{} + voidVoidThird(callback: voidVoidThirdCallback): void{} + + static readonly COMMAND_VOID_VOID_FIRST = 1; + static readonly COMMAND_VOID_VOID_SECOND = 2; + static readonly COMMAND_VOID_VOID_THIRD = 3; +} + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/i_interface_declare.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/i_interface_declare.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9469ce4d7e1d4fbd3ec452076ab8121b8b8adf7 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/i_interface_declare.ts @@ -0,0 +1,21 @@ +/* + * 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 interface IInterfaceDeclare { + testInterface(data: number, callback: testInterfaceCallback): void; +} +export type testInterfaceCallback = (errCode: number) => void; + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_proxy.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_proxy.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f9cc9c43d3b15599f88aa223e7308c43b997e60 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_proxy.ts @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {testInterfaceCallback} from "./i_interface_declare"; +import IInterfaceDeclare from "./i_interface_declare"; +import rpc from "@ohos.rpc"; + +export default class InterfaceDeclareProxy implements IInterfaceDeclare { + constructor(proxy) { + this.proxy = proxy; + } + + testInterface(data: number, callback: testInterfaceCallback): void + { + let _option = new rpc.MessageOption(rpc.MessageOption.TF_SYNC); + let _data = new rpc.MessageParcel(); + let _reply = new rpc.MessageParcel(); + _data.writeInt(data); + this.proxy.sendRequest(InterfaceDeclareProxy.COMMAND_TEST_INTERFACE, _data, _reply, _option).then(function(result) { + if (result.errCode === 0) { + let _errCode = result.reply.readInt(); + callback(_errCode); + } else { + console.log("sendRequest failed, errCode: " + result.errCode); + } + }) + } + + static readonly COMMAND_TEST_INTERFACE = 1; + private proxy +} + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_stub.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_stub.ts new file mode 100644 index 0000000000000000000000000000000000000000..1606f77b4c0390be639f06cb093ee672cf05d478 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/interfaceDeclare/interface_declare_stub.ts @@ -0,0 +1,47 @@ +/* + * 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 {testInterfaceCallback} from "./i_interface_declare"; +import IInterfaceDeclare from "./i_interface_declare"; +import rpc from "@ohos.rpc"; + +export default class InterfaceDeclareStub extends rpc.RemoteObject implements IInterfaceDeclare { + constructor(des: string) { + super(des); + } + + onRemoteRequest(code: number, data, reply, option): boolean { + console.log("onRemoteRequest called, code = " + code); + switch(code) { + case InterfaceDeclareStub.COMMAND_TEST_INTERFACE: { + let _data = data.readInt(); + this.testInterface(_data, (errCode) => { + reply.writeInt(errCode); + }); + return true; + } + default: { + console.log("invalid request code" + code); + break; + } + } + return false; + } + + testInterface(data: number, callback: testInterfaceCallback): void{} + + static readonly COMMAND_TEST_INTERFACE = 1; +} + diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b3495d6f447ce798ad40e21676e40434f78ee68 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,64 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters['timeout'] = 10000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Test App') + .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/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b86f5096f1273b71299ee08e085211c5add410 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second.ets b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second.ets rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second.ets diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/pages/second/second.ets diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/test/Ability.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/test/Ability.test.ets rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/test/Ability.test.ets diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/test/List.test.ets rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/test/List.test.ets diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/i_zidl_tool_test.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/i_zidl_tool_test.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/i_zidl_tool_test.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/i_zidl_tool_test.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/my_sequenceable.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/my_sequenceable.ts new file mode 100644 index 0000000000000000000000000000000000000000..742b78e6a737b29de1a909d4ed6c03b1768064cd --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/my_sequenceable.ts @@ -0,0 +1,28 @@ +export default class MySequenceable { + constructor() { + this.num = 32; + this.str = "nihao"; + } + getNum() : number { + return this.num; + } + + getString() : string { + return this.str; + } + + marshalling(messageParcel) { + console.info('marshalling++++'); + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + return true; + } + unmarshalling(messageParcel) { + console.info('unmarshalling++++'); + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + return true; + } + private num; + private str; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/zidl_tool_test_proxy.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/zidl_tool_test_proxy.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/zidl_tool_test_proxy.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlTool/zidl_tool_test_proxy.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts new file mode 100644 index 0000000000000000000000000000000000000000..a17db0f5d20ac1d674258b1e094355c2276fc2b4 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export default interface IInterfaceAttributeDeclaratoinOneway { + voidVoidFirst(callback: voidVoidFirstCallback): void; + voidVoidSecond(callback: voidVoidSecondCallback): void; + voidVoidThird(callback: voidVoidThirdCallback): void; +} +export type voidVoidFirstCallback = (errCode: number) => void; +export type voidVoidSecondCallback = (errCode: number) => void; +export type voidVoidThirdCallback = (errCode: number) => void; + diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/interface_attribute_declaratoin_oneway_proxy.ts b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/interface_attribute_declaratoin_oneway_proxy.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/interface_attribute_declaratoin_oneway_proxy.ts rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/ets/zidlToolOneWay/interface_attribute_declaratoin_oneway_proxy.ts diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/module.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/module.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/module.json rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/module.json diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/resources/base/element/string.json rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/element/string.json diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlclienttest/signature/openharmony_sx.p7b b/ability/ability_runtime/zidltest/actsamszidlclienttest/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlclienttest/signature/openharmony_sx.p7b rename to ability/ability_runtime/zidltest/actsamszidlclienttest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/app.json b/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..89dc01d02a14fa22dbd7b4abe8cf15517c6e9b02 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.zidlservice", + "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/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/resources/base/element/string.json b/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..be09cccde1bc7369ef47a5cd45d2b06884c88602 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/zidltest/actsamszidlservice/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/zidltest/actsamszidlservice/AppScope/resources/base/media/app_icon.png diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/BUILD.gn b/ability/ability_runtime/zidltest/actsamszidlservice/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/BUILD.gn rename to ability/ability_runtime/zidltest/actsamszidlservice/BUILD.gn diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/Test.json b/ability/ability_runtime/zidltest/actsamszidlservice/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..98eb012db14b28a1f92522e305b9d4538e496dd3 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* 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.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..3b14eab6176b2efafc47359b4875d61774d66c9c --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* +* 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("ACTS_ProcessManage VendorAppService MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("ACTS_ProcessManage VendorAppService MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("ACTS_ProcessManage VendorAppService MainAbility onWindowStageDestroy") + } + + async onForeground() { + // Ability has brought to foreground + console.log("ACTS_ProcessManage VendorAppService MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("ACTS_ProcessManage VendorAppService MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..59a8864b1e2b7196abfc979fcd2cdbeb43b6c953 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,434 @@ +/* +* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' +import Want from '@ohos.application.Want'; +import {voidOutStringCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOutIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutMapStringIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutStringArrayCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutIntCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidInOutStringCallback} from "./zidlTool/i_zidl_tool_test"; +import {booleanVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {byteVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {shortVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {intVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {longVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {floatVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {doubleVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {stringVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {sequenceableVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {interfaceVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {mapStringStringVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {doubleArrayVoidCallback} from "./zidlTool/i_zidl_tool_test"; +import {voidOrderOutInCallback} from "./zidlTool/i_zidl_tool_test" +import {voidOrderInOutInCallback} from "./zidlTool/i_zidl_tool_test" +import {voidOrderOutInOutCallback} from "./zidlTool/i_zidl_tool_test" +import {voidOrderInInOutOutCallback} from "./zidlTool/i_zidl_tool_test" +import {onewayVoidVoidCallback} from "./zidlTool/i_zidl_tool_test" +import {voidInMapStringIntCallback} from "./zidlTool/i_zidl_tool_test" +import {voidVoidCallback} from "./zidlTool/i_zidl_tool_test" +import {voidInStringArrayCallback} from "./zidlTool/i_zidl_tool_test" +import ZidlTestServiceStub from './zidlTool/zidl_tool_test_stub'; +import MySequenceable from "./zidlTool/my_sequenceable"; +import InterfaceDeclareProxy from './interfaceDeclare/interface_declare_proxy' +import InterfaceDeclareStub from './interfaceDeclare/interface_declare_stub' +import {voidInIntCallback} from "./zidlTool/i_zidl_tool_test" +import {voidInStringCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeBooleanCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeByteCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeShortCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeIntCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeLongCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeFloatCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeDoubleCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeStringCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeSequenceableCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeInterfaceCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeMapStringStringCallback} from "./zidlTool/i_zidl_tool_test" +import {voidParameterTypeDoubleArrayCallback} from "./zidlTool/i_zidl_tool_test" +import {testInterfaceCallback} from './interfaceDeclare/i_interface_declare' + +var SUCCESS = 0; +var FAIL = 1; + +class ZidlTestImp extends ZidlTestServiceStub { + + onewayVoidVoid(callback: onewayVoidVoidCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0200 called"); + callback(SUCCESS); + } + + voidVoid(callback: voidVoidCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0300 called"); + callback(SUCCESS); + } + + booleanVoid(callback: booleanVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0400 called"); + var boolean = true; + callback(SUCCESS, boolean); + } + + byteVoid(callback: byteVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0500 called"); + var mybyte = 1; + callback(SUCCESS, mybyte); + } + + shortVoid(callback: shortVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0600 called"); + var myshort = 222; + callback(SUCCESS, myshort); + } + + intVoid(callback: intVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0700 called"); + var myint = 333; + callback(SUCCESS, myint); + } + + longVoid(callback: longVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0800 called"); + var mylong = 4444; + callback(SUCCESS, mylong); + } + + floatVoid(callback: floatVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0900 called"); + var myfloat = 10.1; + callback(SUCCESS, myfloat); + } + + doubleVoid(callback: doubleVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1000 called"); + var mydouble = 22.1; + callback(SUCCESS, mydouble); + } + + stringVoid(callback: stringVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1100 called"); + var mystring = "stringVoid"; + callback(SUCCESS, mystring); + } + + sequenceableVoid(callback: sequenceableVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1200 called"); + let mySequence = new MySequenceable(); + callback(SUCCESS, mySequence); + } + + interfaceVoid(callback: interfaceVoidCallback) { + class InterfaceDeclare extends InterfaceDeclareStub { + testInterface(data: number, callback: testInterfaceCallback): void{ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1300 interfaceStub called"); + let result = FAIL; + + if (data == 1500) { + result = SUCCESS; + } + callback(result); + } + } + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1300 toolStub called"); + let serverInterface = new InterfaceDeclare('serverInterface'); + callback(SUCCESS, serverInterface); + } + + mapStringStringVoid(callback: mapStringStringVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1400 called"); + let myMap = new Map(); + myMap.set("string1","string2"); + callback(SUCCESS, myMap); + } + + doubleArrayVoid(callback: doubleArrayVoidCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1500 called"); + var array = [1.1, 2.1, 3.1]; + callback(SUCCESS, array); + } + + voidInMapStringInt(myMap, callback: voidInMapStringIntCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1600_1 called:'+ myMap.get("string1")); + if(myMap.get("string1") == 1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidInStringArray(strarray, callback: voidInStringArrayCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_1600_2 called:"+ JSON.stringify(strarray)); + if(strarray[0] == "aaa"&&strarray[1] == "bbb"&&strarray[2] == "ccc"){ + callback(SUCCESS); + }else { + callback(FAIL); + } + } + + voidOutMapStringInt(callback : voidOutMapStringIntCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1700 called'); + var map=new Map(); + map.set("voidOutMapStringInt", 1); + callback(SUCCESS, map); + } + + voidOutStringArray(callback :voidOutStringArrayCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1700 called'); + var strarray = ["aa", "dd"]; + callback(SUCCESS, strarray); + } + + voidInOutMapStringInt(mapIn, callback: voidInOutMapStringIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1800 called'); + var errCode = FAIL; + if ((mapIn.get("voidInOutMapStringInt1") == 1801) && + (mapIn.get("voidInOutMapStringInt2") == 1802)) { + mapIn.set("voidInOutMapStringInt1", 1802); + mapIn.set("voidInOutMapStringInt2", 1801); + errCode = SUCCESS; + } + callback(errCode, mapIn); + } + + voidInOutStringArray(strArrayIn, callback: voidInOutStringArrayCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1800 called'); + var errCode = FAIL; + if ((strArrayIn[0] == "ddd") && + (strArrayIn[1] == "ccc")) { + strArrayIn[0] = "aaa"; + strArrayIn[1] = "bbb"; + errCode = SUCCESS; + } + callback(errCode, strArrayIn); + } + + voidInInt(number, callback : voidInIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1900 called:'+ JSON.stringify(number)); + if(number == 8888){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidInString(string, callback : voidInStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_1900 called:'+ JSON.stringify(string)); + if(string == "voidInString"){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidOutInt(callback : voidOutIntCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2000 called'); + var number = 123; + callback(SUCCESS, number); + } + + voidOutString(callback : voidOutStringCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2000 called'); + var string = "voidOutString"; + callback(SUCCESS, string); + } + + voidInOutInt(number, callback: voidInOutIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_1 called:'+ JSON.stringify(number)); + var num = 456789; + if(number == 123456){ + callback(SUCCESS, num); + }else{ + callback(FAIL, number); + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_1 Call_Fail') + } + } + voidInOutString(strinput, callback: voidInOutStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_2 called:'+ JSON.stringify(strinput)); + var str = "456789"; + if(strinput == "voidInOutString"){ + callback(SUCCESS, str); + }else{ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2100_2 Call_Fail'); + callback(FAIL, strinput); + } + } + + voidParameterTypeBoolean(oBooleanTrue, callback : voidParameterTypeBooleanCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2200 called:'+ JSON.stringify(oBooleanTrue)); + if(oBooleanTrue == true){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeByte(number, callback : voidParameterTypeByteCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2300 called:'+ JSON.stringify(number)); + if(number == 1111){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeShort(number, callback : voidParameterTypeShortCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2400 called:'+ JSON.stringify(number)); + if(number == 2222){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeInt(number, callback : voidParameterTypeIntCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2500 called:'+ JSON.stringify(number)); + if(number == 3333){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeLong(number, callback : voidParameterTypeLongCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2600 called:'+ JSON.stringify(number)); + if(number == 4444){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeFloat(number, callback : voidParameterTypeFloatCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2700 called:'+ JSON.stringify(number)); + if(number == 5555.1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeDouble(number, callback : voidParameterTypeDoubleCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2800 called:'+ JSON.stringify(number)); + if(number == 6666.1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeString(string, callback : voidParameterTypeStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_2900 called:'+ JSON.stringify(string)); + if(string == "voidParameterTypeString"){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeSequenceable(MySequenceable, callback : voidParameterTypeSequenceableCallback) { + console.log('ZidlTest Process Server ACTS_Zidl_Js2JsMulti_3000 called:'+ JSON.stringify(MySequenceable)); + if((MySequenceable != null) && (MySequenceable.getNum() == 32) && (MySequenceable.getString() == "nihao")){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeInterface(param: InterfaceDeclareProxy, callback : voidParameterTypeInterfaceCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3100 called"); + let proxy = new InterfaceDeclareProxy(param); + proxy.testInterface(3300, (errCode)=>{ + if (errCode == SUCCESS) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3100 callback SUCCESS"); + callback(SUCCESS); + } else { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3100 callback FAIL"); + callback(FAIL); + } + }); + + } + + voidParameterTypeMapStringString(map, callback : voidParameterTypeMapStringStringCallback) { + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_3200 called:'+ map.get("voidParameterTypeMapStringString")); + if(map.get("voidParameterTypeMapStringString") == "fdhatdh"){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidParameterTypeDoubleArray(array, callback : voidParameterTypeDoubleArrayCallback){ + console.log('ZidlTest Server ACTS_Zidl_Js2JsMulti_3300 called:'+ JSON.stringify(array)); + if(array.length == 2 && array[0] == 1.1 && array[1] == 2.1){ + callback(SUCCESS); + }else{ + callback(FAIL); + } + } + + voidOrderOutIn(paramI, callback: voidOrderOutInCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3400 called" + paramI); + var mystring = "hello world"; + callback(SUCCESS, mystring); + } + + voidOrderInOutIn(paramI, paramS, callback: voidOrderInOutInCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3500 called" + paramI + " " + paramS); + var mynumber = 6; + callback(SUCCESS, mynumber); + } + + voidOrderOutInOut(paramS, callback: voidOrderOutInOutCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3600 called" + paramS); + var mynumber = 3; + var mystring = "paramcallback"; + callback(SUCCESS, mynumber, mystring); + } + + voidOrderInInOutOut(paramS, paramI, callback: voidOrderInInOutOutCallback){ + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_3700 called" + paramS + " " + paramI); + var mystring = "callback"; + var mynumber = 4; + callback(SUCCESS, mynumber, mystring); + } +} + +export default class ServiceAbility extends ServiceExtension { + onCreate(want: Want) { + globalThis.abilityWant = want; + console.log('ZidlService ServiceAbility onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ZidlService ServiceAbility onRequest, want: ' + want.abilityName + + ', startId: ' + startId); + } + + onConnect(want) { + console.log('ZidlService ServiceAbility onConnect, want:' + want.abilityName); + return new ZidlTestImp('connect'); + } + + onDisconnect(want) { + console.log('ZidlService ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('AZidlService ServiceAbility onDestroy'); + } +}; diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9469ce4d7e1d4fbd3ec452076ab8121b8b8adf7 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/i_interface_declare.ts @@ -0,0 +1,21 @@ +/* + * 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 interface IInterfaceDeclare { + testInterface(data: number, callback: testInterfaceCallback): void; +} +export type testInterfaceCallback = (errCode: number) => void; + diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f9cc9c43d3b15599f88aa223e7308c43b997e60 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_proxy.ts @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {testInterfaceCallback} from "./i_interface_declare"; +import IInterfaceDeclare from "./i_interface_declare"; +import rpc from "@ohos.rpc"; + +export default class InterfaceDeclareProxy implements IInterfaceDeclare { + constructor(proxy) { + this.proxy = proxy; + } + + testInterface(data: number, callback: testInterfaceCallback): void + { + let _option = new rpc.MessageOption(rpc.MessageOption.TF_SYNC); + let _data = new rpc.MessageParcel(); + let _reply = new rpc.MessageParcel(); + _data.writeInt(data); + this.proxy.sendRequest(InterfaceDeclareProxy.COMMAND_TEST_INTERFACE, _data, _reply, _option).then(function(result) { + if (result.errCode === 0) { + let _errCode = result.reply.readInt(); + callback(_errCode); + } else { + console.log("sendRequest failed, errCode: " + result.errCode); + } + }) + } + + static readonly COMMAND_TEST_INTERFACE = 1; + private proxy +} + diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts new file mode 100644 index 0000000000000000000000000000000000000000..1606f77b4c0390be639f06cb093ee672cf05d478 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/interfaceDeclare/interface_declare_stub.ts @@ -0,0 +1,47 @@ +/* + * 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 {testInterfaceCallback} from "./i_interface_declare"; +import IInterfaceDeclare from "./i_interface_declare"; +import rpc from "@ohos.rpc"; + +export default class InterfaceDeclareStub extends rpc.RemoteObject implements IInterfaceDeclare { + constructor(des: string) { + super(des); + } + + onRemoteRequest(code: number, data, reply, option): boolean { + console.log("onRemoteRequest called, code = " + code); + switch(code) { + case InterfaceDeclareStub.COMMAND_TEST_INTERFACE: { + let _data = data.readInt(); + this.testInterface(_data, (errCode) => { + reply.writeInt(errCode); + }); + return true; + } + default: { + console.log("invalid request code" + code); + break; + } + } + return false; + } + + testInterface(data: number, callback: testInterfaceCallback): void{} + + static readonly COMMAND_TEST_INTERFACE = 1; +} + diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/service.ts rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/service.ts diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/i_zidl_tool_test.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts new file mode 100644 index 0000000000000000000000000000000000000000..bef9dcbe25c82b2c96e8ac8cc6493ce3d080baf6 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/my_sequenceable.ts @@ -0,0 +1,28 @@ +export default class MySequenceable { + constructor() { + this.num = 14; + this.str = "hello"; + } + getNum() : number { + return this.num; + } + + getString() : string { + return this.str; + } + + marshalling(messageParcel) { + console.info('marshalling++++'); + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + return true; + } + unmarshalling(messageParcel) { + console.info('unmarshalling++++'); + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + return true; + } + private num; + private str; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility/zidlTool/zidl_tool_test_stub.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..77d68a9d282f8f10b04cf8605f63c41f8165243e --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,65 @@ +/* +* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' +import Want from '@ohos.application.Want'; +import ZidlTestServiceStubOneway from './zidlToolOneWay/interface_attribute_declaratoin_oneway_stub'; +import {voidVoidFirstCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' +import {voidVoidSecondCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' +import {voidVoidThirdCallback} from './zidlToolOneWay/i_interface_attribute_declaratoin_oneway' + +const SUCCESS = 0; +const FAIL = 1; + +class ZidlTestImpOneway extends ZidlTestServiceStubOneway { + voidVoidFirst(callback: voidVoidFirstCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0100_1 called"); + callback(SUCCESS); + } + + voidVoidSecond(callback: voidVoidSecondCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0100_2 called"); + callback(SUCCESS); + } + + voidVoidThird(callback: voidVoidThirdCallback) { + console.log("ZidlTest Server ACTS_Zidl_Js2JsMulti_0100_3 called"); + callback(SUCCESS); + } +} + +export default class ServiceAbility2 extends ServiceExtension { + onCreate(want: Want) { + globalThis.abilityWant = want; + console.log('ZidlService ServiceAbility2 onCreate, want: ' + want.abilityName); + } + + onRequest(want, startId) { + console.log('ZidlService ServiceAbility2 onRequest, want: ' + want.abilityName + + ', startId: ' + startId); + } + + onConnect(want) { + console.log('ZidlService ServiceAbility2 onConnect, want:' + want.abilityName); + return new ZidlTestImpOneway('connect'); + } + + onDisconnect(want) { + console.log('ZidlService ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('AZidlService ServiceAbility2 onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/service.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/service.ts old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/service.ts rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/service.ts diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts new file mode 100644 index 0000000000000000000000000000000000000000..a17db0f5d20ac1d674258b1e094355c2276fc2b4 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/i_interface_attribute_declaratoin_oneway.ts @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export default interface IInterfaceAttributeDeclaratoinOneway { + voidVoidFirst(callback: voidVoidFirstCallback): void; + voidVoidSecond(callback: voidVoidSecondCallback): void; + voidVoidThird(callback: voidVoidThirdCallback): void; +} +export type voidVoidFirstCallback = (errCode: number) => void; +export type voidVoidSecondCallback = (errCode: number) => void; +export type voidVoidThirdCallback = (errCode: number) => void; + diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts new file mode 100644 index 0000000000000000000000000000000000000000..016f352bd6d609916ad6e3b12e63e075a6fbe490 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/ServiceAbility2/zidlToolOneWay/interface_attribute_declaratoin_oneway_stub.ts @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {voidVoidFirstCallback} from "./i_interface_attribute_declaratoin_oneway"; +import {voidVoidSecondCallback} from "./i_interface_attribute_declaratoin_oneway"; +import {voidVoidThirdCallback} from "./i_interface_attribute_declaratoin_oneway"; +import IInterfaceAttributeDeclaratoinOneway from "./i_interface_attribute_declaratoin_oneway"; +import rpc from "@ohos.rpc"; + +export default class InterfaceAttributeDeclaratoinOnewayStub extends rpc.RemoteObject implements IInterfaceAttributeDeclaratoinOneway { + constructor(des: string) { + super(des); + } + + onRemoteRequest(code: number, data, reply, option): boolean { + console.log("onRemoteRequest called, code = " + code); + switch(code) { + case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_FIRST: { + this.voidVoidFirst((errCode) => { + reply.writeInt(errCode); + }); + return true; + } + case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_SECOND: { + this.voidVoidSecond((errCode) => { + reply.writeInt(errCode); + }); + return true; + } + case InterfaceAttributeDeclaratoinOnewayStub.COMMAND_VOID_VOID_THIRD: { + this.voidVoidThird((errCode) => { + reply.writeInt(errCode); + }); + return true; + } + default: { + console.log("invalid request code" + code); + break; + } + } + return false; + } + + voidVoidFirst(callback: voidVoidFirstCallback): void{} + voidVoidSecond(callback: voidVoidSecondCallback): void{} + voidVoidThird(callback: voidVoidThirdCallback): void{} + + static readonly COMMAND_VOID_VOID_FIRST = 1; + static readonly COMMAND_VOID_VOID_SECOND = 2; + static readonly COMMAND_VOID_VOID_THIRD = 3; +} + diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/pages/index/index.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/pages/index/index.ets rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/pages/index/index.ets diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/pages/second/second.ets b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/pages/second/second.ets old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/entry/src/main/ets/pages/second/second.ets rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/ets/pages/second/second.ets diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a30b037489b5d261b7405e566bc6352014518367 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json @@ -0,0 +1,99 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.zidlservice.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/ServiceAbility/ServiceAbility.ts", + "name": "com.example.zidlservice.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.zidlservice.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "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.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "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/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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/aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/media/icon.png similarity index 100% rename from aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/zidltest/actsamszidlservice/signature/openharmony_sx.p7b b/ability/ability_runtime/zidltest/actsamszidlservice/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from aafwk/aafwk_standard/zidltest/actsamszidlservice/signature/openharmony_sx.p7b rename to ability/ability_runtime/zidltest/actsamszidlservice/signature/openharmony_sx.p7b diff --git a/test_packages.gni b/test_packages.gni index 5d5268f0e77758d0a59f927fa00411b7172077f8..81b52036cc65aedc2e987c8478f8b8cad19ee3d8 100644 --- a/test_packages.gni +++ b/test_packages.gni @@ -22,7 +22,7 @@ _all_test_packages = [ "${ACTS_ROOT}/account:account", "${ACTS_ROOT}/communication:communication", "${ACTS_ROOT}/notification:notification", - "${ACTS_ROOT}/aafwk:aafwk", + "${ACTS_ROOT}/ability:ability", "${ACTS_ROOT}/miscservices:miscservices", "${ACTS_ROOT}/powermgr:powermgr", "${ACTS_ROOT}/startup:startup",