diff --git a/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn b/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn
index 00cc7dcb1444be838e228dc7f851dc56076cbf32..f1fdbde7189be1310a8a681410275073a6ea864e 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn
+++ b/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn
index 2082d9d27033702997af10761ec28b411ba84240..67aea9e8d46b76bbc126e0c967883b0459f68b76 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn
@@ -9,13 +9,13 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsServiceAbilityClientTest") {
hap_name = "ActsServiceAbilityClientTest"
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsServiceAbilityClientTest") {
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/Test.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/Test.json
index fc8db610c43398f0851ea9cff40424edfa2d1e28..c6474204595f637f402762206e940c3370f3c42b 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/Test.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/Test.json
@@ -1,20 +1,22 @@
-{
- "description": "Configuration for hjunit demo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "180000",
- "package": "com.amsst.stserviceabilityclient",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsServiceAbilityClientTest.hap",
- "ActsServiceAbilityServerRelyHap.hap",
- "ActsServiceAbilityServerSecondRelyHap.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "600000",
+ "bundle-name": "com.amsst.stserviceabilityclient",
+ "package-name": "com.amsst.stserviceabilityclient",
+ "shell-timeout": "600000",
+ "testcase-timeout": 30000
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsServiceAbilityClientTest.hap",
+ "ActsServiceAbilityServerRelyHap.hap",
+ "ActsServiceAbilityServerSecondRelyHap.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index a3d6946ded2ae6c810549377cc0c386ad257eb53..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "StSeAbClient"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/config.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json
similarity index 62%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/config.json
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json
index c223b53b4a4ee8b22950547c69da3cc969bc3517..c8779ae95cecb444f31bb20fa6d8f8c2a2e6fdc1 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/config.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json
@@ -1,91 +1,124 @@
-{
- "app": {
- "bundleName": "com.amsst.stserviceabilityclient",
- "vendor": "amsst",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.amsst.stserviceabilityclient",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.amsst.stserviceabilityclient.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard",
- "visible": true
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.INSTALL_BUNDLE",
- "reason": "need use ohos.permission.INSTALL_BUNDLE"
- },
- {
- "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.MANAGE_LOCAL_ACCOUNTS",
- "reason":"need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
-}
+{
+ "app": {
+ "bundleName": "com.amsst.stserviceabilityclient",
+ "vendor": "amsst",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.amsst.stserviceabilityclient",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.INSTALL_BUNDLE",
+ "reason": "need use ohos.permission.INSTALL_BUNDLE"
+ },
+ {
+ "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.MANAGE_LOCAL_ACCOUNTS",
+ "reason":"need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/app.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/app.js
similarity index 97%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/app.js
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/app.js
index c158442201abb1888ae8fb1d57f150c5ec26c36b..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/app.js
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/app.js
@@ -1,22 +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');
- }
-};
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/i18n/en-US.json
similarity index 91%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/i18n/en-US.json
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/en-US.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/i18n/en-US.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 91%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/i18n/zh-CN.json
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/i18n/zh-CN.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/i18n/zh-CN.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.css
similarity index 93%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.css
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.css
index ac39915c295d19be6b0c23ae374d30b8f13bc066..e406cdc136e2c5c5c7b6f25220bbe406bc47262b 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.css
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.css
@@ -1,12 +1,12 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
-.titleST {
- font-size: 32px;
-}
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+.titleST {
+ font-size: 32px;
+}
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.hml
similarity index 95%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.hml
index 22cf7f2cc551020b093687fa5c15d59fd308de59..db3e6d95250a25b5316ac3d436042140ac1ca01b 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.hml
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.hml
@@ -1,8 +1,8 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
- StServiceAbilityClient
-
-
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
+ StServiceAbilityClient
+
+
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.js
similarity index 62%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.js
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.js
index 4bfa4f7e4a4085d7336a97befffb8d52882d281d..262b032de9723b44892a3cf2040cd9097d786645 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/pages/index/index.js
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/MainAbility/pages/index/index.js
@@ -1,44 +1,37 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import file from '@system.file'
-import app from '@system.app'
-import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('====onShow finish====<')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- const reportExtend = new ReportExtend(file)
- core.addService('expect', expectExtend)
- core.addService('report', reportExtend)
- core.init()
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
-
- require('../../../test/List.test')
- core.execute()
- },
- onReady() {
- },
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../../../test/List.test'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('====onShow finish====<')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onReady() {
+ },
}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/app.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/app.js
similarity index 91%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/app.js
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/app.js
index 8e47afff13e928a74fdcc01a108e4422404b9ac9..875191631733a62e2bdff76d6b5a2e2f1b130937 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/app.js
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/app.js
@@ -1,23 +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');
- }
-};
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.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;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.hml
similarity index 95%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..f629c71a9be857db6cdf94149652a191b9b272ea 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.hml
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.hml
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+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', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/test/List.test.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/List.test.js
similarity index 78%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/test/List.test.js
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/List.test.js
index b95011487ce47ce48bb7b8b8f1bcee9e5f563cdc..02d07238ac41e223dcab6a224fbbab703b694519 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/test/List.test.js
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/List.test.js
@@ -1,15 +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.
- */
-require('./StServiceAbilityClient.test.js')
\ No newline at end of file
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import ActsStServiceAbilityTest from './StServiceAbilityClient.test.js'
+
+export default function testsuite() {
+ ActsStServiceAbilityTest()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/test/StServiceAbilityClient.test.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js
similarity index 97%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/test/StServiceAbilityClient.test.js
rename to ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js
index 6ddd578d453953016fbca50d5a6dd521b6510a19..51c02cccfac200139fc1681267318dbad61b4bc6 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/test/StServiceAbilityClient.test.js
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js
@@ -1,854 +1,856 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsStServiceAbilityTest', function () {
- let bundleName = "com.amsst.stserviceabilityserver";
- let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility";
-
- var subscriber0100;
- var CommonEventSubscribeInfo0100 = {
- events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0100",
- ],
- };
- var subscriber0200;
- var CommonEventSubscribeInfo0200 = {
- events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0200",
- ],
- };
- var subscriber0300;
- var CommonEventSubscribeInfo0300 = {
- events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0300",
- "ACTS_SerivceAbilityServer_onCommand_PageStartService_0301",
- ],
- };
- var subscriber0400;
- var CommonEventSubscribeInfo0400 = {
- events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0400",
- "ACTS_SerivceAbilityServer_onCommand_PageStartService_0401",
- ],
- };
- var subscriber0500;
- var CommonEventSubscribeInfo0500 = {
- events: ["ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500",
- "ACTS_SerivceAbilityServer_onDisConnect",
- ],
- };
- var subscriber0600;
- var CommonEventSubscribeInfo0600 = {
- events: ["ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600",
- "ACTS_SerivceAbilityServer_onDisConnect",
- ],
- };
- var subscriber0900;
- var CommonEventSubscribeInfo0900 = {
- events: ["ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900",
- ],
- };
- var subscriber1000;
- var CommonEventSubscribeInfo1000 = {
- events: ["ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000",
- ],
- };
- var subscriber1300;
- var CommonEventSubscribeInfo1300 = {
- events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300",
- "ACTS_SerivceAbilityServerSecond_onDisConnect",
- ],
- };
- var subscriber1400;
- var CommonEventSubscribeInfo1400 = {
- events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400",
- "ACTS_SerivceAbilityServerSecond_onDisConnect",
- ],
- };
- var subscriber1500;
- var CommonEventSubscribeInfo1500 = {
- events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500",
- "ACTS_SerivceAbilityServer_onDisConnect",
- ],
- };
-
- function unsubscribe(caller, subscriber) {
- commonEvent.unsubscribe(subscriber, (err, data) => {
- console.debug("=ACTS_unsubscribe (err,data)=======>"
- + (caller)
- + (" , json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- });
- }
- let gSetTimeout = 1000
- beforeAll(async (done) => {
- console.debug('= ACTS_beforeAll ==== {
- setTimeout(function () {
- done();
- }, gSetTimeout);
- })
- afterEach(async (done) => {
- setTimeout(function () {
- done();
- }, gSetTimeout);
- })
- afterAll((done) => {
- console.debug('= ACTS_afterAll ==== {
- console.debug("=ACTS_JsServiceAbility_0100 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0100 = data;
- await commonEvent.subscribe(subscriber0100, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0100 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0100").assertEqual(
- data.event);
- unsubscribe("ACTS_JsServiceAbility_0100_unsubscribe", subscriber0100);
- console.debug('ACTS_JsServiceAbility_0100==== {
- console.debug("=ACTS_JsServiceAbility_0100 .then(data)=======>"
- + ("abilityStartSetting json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- }).catch(err => {
- expect(".catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0100==== {
- console.debug("=ACTS_JsServiceAbility_0200 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0200 = data;
- await commonEvent.subscribe(subscriber0200, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0200 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0200").assertEqual(
- data.event);
- unsubscribe("ACTS_JsServiceAbility_0200_unsubscribe", subscriber0200);
- console.debug('ACTS_JsServiceAbility_0200==== {
- console.debug("=ACTS_JsServiceAbility_0200 startAbility (err,data)=======>"
- + ("abilityStartSetting json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- }
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0200==== {
- console.debug("=ACTS_JsServiceAbility_0300 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0300 = data;
- await commonEvent.subscribe(subscriber0300, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0300 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0300") {
- expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0300").assertEqual(
- data.event);
- featureAbility.startAbility(
- {
- want:
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "PageStartService_0301",
- },
- }
- ).then(data => {
- console.debug("=ACTS_JsServiceAbility_0300 .then(data) 2=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- }).catch(err => {
- expect(".catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0300==== {
- console.debug("=ACTS_JsServiceAbility_0300 .then(data) 1=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- }).catch(err => {
- expect(".catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0300==== {
- console.debug("=ACTS_JsServiceAbility_0400 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0400 = data;
- await commonEvent.subscribe(subscriber0400, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0400 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0400") {
- expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0400").assertEqual(
- data.event);
- featureAbility.startAbility(
- {
- want:
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "PageStartService_0401",
- },
- }, (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0400 startAbility (err,data) 2=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- }
- )
- } else {
- expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0401").assertEqual(
- data.event);
- unsubscribe("ACTS_JsServiceAbility_0400_unsubscribe", subscriber0400);
- console.debug('ACTS_JsServiceAbility_0400==== {
- console.debug("=ACTS_JsServiceAbility_0400 startAbility (err,data) 1=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- }
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0400==== {
- console.debug("=ACTS_JsServiceAbility_0500 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0500 = data;
- await commonEvent.subscribe(subscriber0500, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0500 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
- expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500").assertEqual(
- data.event);
- featureAbility.disconnectAbility(mConnIdJsPromise).then(() => {
- }).catch(err => {
- expect(".catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0500==== mConnIdJsPromise='
- + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise);
- console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote is proxy:'
- + (remote instanceof rpc.RemoteProxy));
- }
-
- function onDisconnectCallback(element) {
- console.debug('ACTS_JsServiceAbility_0500_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- }
-
- function onFailedCallback(code) {
- console.debug('ACTS_JsServiceAbility_0500_onFailedCallback ====> code='
- + JSON.stringify(code) + " , " + code)
- }
-
- mConnIdJsPromise = featureAbility.connectAbility(
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "PageConnectService_0500",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.log('ACTS_JsServiceAbility_0500==== {
- console.debug("=ACTS_JsServiceAbility_0600 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0600 = data;
- await commonEvent.subscribe(subscriber0600, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0600 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
- expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600").assertEqual(
- data.event);
- featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => {
- console.debug("=ACTS_JsServiceAbility_0600 disconnectAbility err====>"
- + ("json err=") + JSON.stringify(err));
- })
- currentAlertTimeout = setTimeout(() => {
- console.log('ACTS_JsServiceAbility_0600==== mConnIdJsAsyncCallback='
- + JSON.stringify(mConnIdJsAsyncCallback) + " , " + mConnIdJsAsyncCallback);
- console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote is proxy:'
- + (remote instanceof rpc.RemoteProxy));
- }
-
- function onDisconnectCallback(element) {
- console.debug('ACTS_JsServiceAbility_0600_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- }
-
- function onFailedCallback(code) {
- console.debug('ACTS_JsServiceAbility_0600_onFailedCallback ====> code='
- + JSON.stringify(code) + " , " + code)
- expect(code==featureAbility.ErrorCode.ABILITY_NOT_FOUND
- || (code!=featureAbility.ErrorCode.NO_ERROR
- || code!=featureAbility.ErrorCode.INVALID_PARAMETER
- || code!=featureAbility.ErrorCode.PERMISSION_DENY
- )).assertTrue();
- }
-
- mConnIdJsAsyncCallback = featureAbility.connectAbility(
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "PageConnectService_0600",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.log('ACTS_JsServiceAbility_0600==== {
- console.debug("=ACTS_JsServiceAbility_0900 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber0900 = data;
- await commonEvent.subscribe(subscriber0900, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_0900 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900").assertEqual(
- data.event);
- unsubscribe("ACTS_JsServiceAbility_0900_unsubscribe", subscriber0900);
- console.debug('ACTS_JsServiceAbility_0900==== {
- console.debug("=ACTS_JsServiceAbility_0900 .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- }).catch(err => {
- expect(".catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_0900==== {
- console.debug("=ACTS_JsServiceAbility_1000 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber1000 = data;
- await commonEvent.subscribe(subscriber1000, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_1000 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000").assertEqual(
- data.event);
- unsubscribe("ACTS_JsServiceAbility_1000_unsubscribe", subscriber1000);
- console.debug('ACTS_JsServiceAbility_1000==== {
- console.debug("=ACTS_JsServiceAbility_1000 startAbility (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- }
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_1000==== {
- console.debug("=ACTS_JsServiceAbility_1300 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber1300 = data;
- await commonEvent.subscribe(subscriber1300, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_1300 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event != "ACTS_SerivceAbilityServerSecond_onDisConnect") {
- expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300"
- ).assertEqual(data.event);
- featureAbility.disconnectAbility(mConnIdJsPromise).then((err) => {
- console.debug("=ACTS_JsServiceAbility_1300 disconnectAbility err====>"
- + ("json err=") + JSON.stringify(err));
- })
- } else {
- expect("ACTS_SerivceAbilityServerSecond_onDisConnect").assertEqual(
- data.event);
- unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300);
- console.log('ACTS_JsServiceAbility_1300==== mConnIdJsPromise='
- + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise);
- console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote is proxy:'
- + (remote instanceof rpc.RemoteProxy));
- }
-
- function onDisconnectCallback(element) {
- console.debug('ACTS_JsServiceAbility_1300_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300);
- console.log('ACTS_JsServiceAbility_1300==== code='
- + JSON.stringify(code) + " , " + code)
- }
-
- mConnIdJsPromise = featureAbility.connectAbility(
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "ServiceConnectService_1300",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.log('ACTS_JsServiceAbility_1300==== {
- console.debug("=ACTS_JsServiceAbility_1400 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber1400 = data;
- await commonEvent.subscribe(subscriber1400, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_1400 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event != "ACTS_SerivceAbilityServerSecond_onDisConnect") {
- expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400"
- ).assertEqual(data.event);
- featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => {
- console.debug("=ACTS_JsServiceAbility_1400 disconnectAbility err====>"
- + ("json err=") + JSON.stringify(err));
- })
- currentAlertTimeout = setTimeout(() => {
- console.log('ACTS_JsServiceAbility_1400==== mConnIdJsAsyncCallback='
- + JSON.stringify(mConnIdJsAsyncCallback) + " , " + mConnIdJsAsyncCallback);
- console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote is proxy:'
- + (remote instanceof rpc.RemoteProxy));
- }
-
- function onDisconnectCallback(element) {
- console.debug('ACTS_JsServiceAbility_1400_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- }
-
- function onFailedCallback(code) {
- console.debug('ACTS_JsServiceAbility_1400_onFailedCallback ====> code='
- + JSON.stringify(code) + " , " + code)
- }
-
- mConnIdJsAsyncCallback = featureAbility.connectAbility(
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "ServiceConnectService_1400",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.log('ACTS_JsServiceAbility_1400==== {
- console.debug("=ACTS_JsServiceAbility_1500 createSubscriber .then(data)=======>"
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,data=" + data);
- subscriber1500 = data;
- await commonEvent.subscribe(subscriber1500, async (err, data) => {
- console.debug("=ACTS_JsServiceAbility_1500 subscribe (err,data)=======>"
- + ("json err【") + JSON.stringify(err) + (" 】")
- + ("json data【") + JSON.stringify(data) + (" 】")
- + " ,err=" + err + " ,data=" + data);
- if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
- expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500").assertEqual(
- data.event);
- featureAbility.disconnectAbility(mConnIdJsPromise).then(() => {
- }).catch(err => {
- expect(".catch").assertEqual(err);
- console.debug('ACTS_JsServiceAbility_1500==== mConnIdJsPromise='
- + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise);
- console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- }
-
- function onDisconnectCallback(element) {
- console.debug('ACTS_JsServiceAbility_1500_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- unsubscribe("ACTS_JsServiceAbility_1500_unsubscribe", subscriber1500);
- console.log('ACTS_JsServiceAbility_1500==== code='
- + JSON.stringify(code) + " , " + code)
- }
-
- mConnIdJsPromise = featureAbility.connectAbility(
- {
- bundleName: bundleName,
- abilityName: abilityName,
- action: "ServiceConnectService_1500",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } catch (err) {
- expect("catch").assertEqual(err);
- console.log('ACTS_JsServiceAbility_1500==== {
+ console.debug("=ACTS_unsubscribe (err,data)=======>"
+ + (caller)
+ + (" , json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ });
+ }
+ let gSetTimeout = 1000
+ beforeAll(async (done) => {
+ console.debug('= ACTS_beforeAll ==== {
+ setTimeout(function () {
+ done();
+ }, gSetTimeout);
+ })
+ afterEach(async (done) => {
+ setTimeout(function () {
+ done();
+ }, gSetTimeout);
+ })
+ afterAll((done) => {
+ console.debug('= ACTS_afterAll ==== {
+ console.debug("=ACTS_JsServiceAbility_0100 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0100 = data;
+ await commonEvent.subscribe(subscriber0100, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0100 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0100").assertEqual(
+ data.event);
+ unsubscribe("ACTS_JsServiceAbility_0100_unsubscribe", subscriber0100);
+ console.debug('ACTS_JsServiceAbility_0100==== {
+ console.debug("=ACTS_JsServiceAbility_0100 .then(data)=======>"
+ + ("abilityStartSetting json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ }).catch(err => {
+ expect(".catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0100==== {
+ console.debug("=ACTS_JsServiceAbility_0200 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0200 = data;
+ await commonEvent.subscribe(subscriber0200, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0200 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0200").assertEqual(
+ data.event);
+ unsubscribe("ACTS_JsServiceAbility_0200_unsubscribe", subscriber0200);
+ console.debug('ACTS_JsServiceAbility_0200==== {
+ console.debug("=ACTS_JsServiceAbility_0200 startAbility (err,data)=======>"
+ + ("abilityStartSetting json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ }
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0200==== {
+ console.debug("=ACTS_JsServiceAbility_0300 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0300 = data;
+ await commonEvent.subscribe(subscriber0300, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0300 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0300") {
+ expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0300").assertEqual(
+ data.event);
+ featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "PageStartService_0301",
+ },
+ }
+ ).then(data => {
+ console.debug("=ACTS_JsServiceAbility_0300 .then(data) 2=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ }).catch(err => {
+ expect(".catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0300==== {
+ console.debug("=ACTS_JsServiceAbility_0300 .then(data) 1=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ }).catch(err => {
+ expect(".catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0300==== {
+ console.debug("=ACTS_JsServiceAbility_0400 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0400 = data;
+ await commonEvent.subscribe(subscriber0400, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0400 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0400") {
+ expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0400").assertEqual(
+ data.event);
+ featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "PageStartService_0401",
+ },
+ }, (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0400 startAbility (err,data) 2=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ }
+ )
+ } else {
+ expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0401").assertEqual(
+ data.event);
+ unsubscribe("ACTS_JsServiceAbility_0400_unsubscribe", subscriber0400);
+ console.debug('ACTS_JsServiceAbility_0400==== {
+ console.debug("=ACTS_JsServiceAbility_0400 startAbility (err,data) 1=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ }
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0400==== {
+ console.debug("=ACTS_JsServiceAbility_0500 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0500 = data;
+ await commonEvent.subscribe(subscriber0500, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0500 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
+ expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500").assertEqual(
+ data.event);
+ featureAbility.disconnectAbility(mConnIdJsPromise).then(() => {
+ }).catch(err => {
+ expect(".catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0500==== mConnIdJsPromise='
+ + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise);
+ console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote is proxy:'
+ + (remote instanceof rpc.RemoteProxy));
+ }
+
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_JsServiceAbility_0500_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ }
+
+ function onFailedCallback(code) {
+ console.debug('ACTS_JsServiceAbility_0500_onFailedCallback ====> code='
+ + JSON.stringify(code) + " , " + code)
+ }
+
+ mConnIdJsPromise = featureAbility.connectAbility(
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "PageConnectService_0500",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.log('ACTS_JsServiceAbility_0500==== {
+ console.debug("=ACTS_JsServiceAbility_0600 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0600 = data;
+ await commonEvent.subscribe(subscriber0600, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0600 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
+ expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600").assertEqual(
+ data.event);
+ featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => {
+ console.debug("=ACTS_JsServiceAbility_0600 disconnectAbility err====>"
+ + ("json err=") + JSON.stringify(err));
+ })
+ currentAlertTimeout = setTimeout(() => {
+ console.log('ACTS_JsServiceAbility_0600==== mConnIdJsAsyncCallback='
+ + JSON.stringify(mConnIdJsAsyncCallback) + " , " + mConnIdJsAsyncCallback);
+ console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote is proxy:'
+ + (remote instanceof rpc.RemoteProxy));
+ }
+
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_JsServiceAbility_0600_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ }
+
+ function onFailedCallback(code) {
+ console.debug('ACTS_JsServiceAbility_0600_onFailedCallback ====> code='
+ + JSON.stringify(code) + " , " + code)
+ expect(code==featureAbility.ErrorCode.ABILITY_NOT_FOUND
+ || (code!=featureAbility.ErrorCode.NO_ERROR
+ || code!=featureAbility.ErrorCode.INVALID_PARAMETER
+ || code!=featureAbility.ErrorCode.PERMISSION_DENY
+ )).assertTrue();
+ }
+
+ mConnIdJsAsyncCallback = featureAbility.connectAbility(
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "PageConnectService_0600",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.log('ACTS_JsServiceAbility_0600==== {
+ console.debug("=ACTS_JsServiceAbility_0900 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber0900 = data;
+ await commonEvent.subscribe(subscriber0900, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_0900 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900").assertEqual(
+ data.event);
+ unsubscribe("ACTS_JsServiceAbility_0900_unsubscribe", subscriber0900);
+ console.debug('ACTS_JsServiceAbility_0900==== {
+ console.debug("=ACTS_JsServiceAbility_0900 .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ }).catch(err => {
+ expect(".catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_0900==== {
+ console.debug("=ACTS_JsServiceAbility_1000 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber1000 = data;
+ await commonEvent.subscribe(subscriber1000, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_1000 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000").assertEqual(
+ data.event);
+ unsubscribe("ACTS_JsServiceAbility_1000_unsubscribe", subscriber1000);
+ console.debug('ACTS_JsServiceAbility_1000==== {
+ console.debug("=ACTS_JsServiceAbility_1000 startAbility (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ }
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_1000==== {
+ console.debug("=ACTS_JsServiceAbility_1300 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber1300 = data;
+ await commonEvent.subscribe(subscriber1300, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_1300 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event != "ACTS_SerivceAbilityServerSecond_onDisConnect") {
+ expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300"
+ ).assertEqual(data.event);
+ featureAbility.disconnectAbility(mConnIdJsPromise).then((err) => {
+ console.debug("=ACTS_JsServiceAbility_1300 disconnectAbility err====>"
+ + ("json err=") + JSON.stringify(err));
+ })
+ } else {
+ expect("ACTS_SerivceAbilityServerSecond_onDisConnect").assertEqual(
+ data.event);
+ unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300);
+ console.log('ACTS_JsServiceAbility_1300==== mConnIdJsPromise='
+ + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise);
+ console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote is proxy:'
+ + (remote instanceof rpc.RemoteProxy));
+ }
+
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_JsServiceAbility_1300_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300);
+ console.log('ACTS_JsServiceAbility_1300==== code='
+ + JSON.stringify(code) + " , " + code)
+ }
+
+ mConnIdJsPromise = featureAbility.connectAbility(
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "ServiceConnectService_1300",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.log('ACTS_JsServiceAbility_1300==== {
+ console.debug("=ACTS_JsServiceAbility_1400 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber1400 = data;
+ await commonEvent.subscribe(subscriber1400, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_1400 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event != "ACTS_SerivceAbilityServerSecond_onDisConnect") {
+ expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400"
+ ).assertEqual(data.event);
+ featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => {
+ console.debug("=ACTS_JsServiceAbility_1400 disconnectAbility err====>"
+ + ("json err=") + JSON.stringify(err));
+ })
+ currentAlertTimeout = setTimeout(() => {
+ console.log('ACTS_JsServiceAbility_1400==== mConnIdJsAsyncCallback='
+ + JSON.stringify(mConnIdJsAsyncCallback) + " , " + mConnIdJsAsyncCallback);
+ console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote is proxy:'
+ + (remote instanceof rpc.RemoteProxy));
+ }
+
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_JsServiceAbility_1400_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ }
+
+ function onFailedCallback(code) {
+ console.debug('ACTS_JsServiceAbility_1400_onFailedCallback ====> code='
+ + JSON.stringify(code) + " , " + code)
+ }
+
+ mConnIdJsAsyncCallback = featureAbility.connectAbility(
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "ServiceConnectService_1400",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.log('ACTS_JsServiceAbility_1400==== {
+ console.debug("=ACTS_JsServiceAbility_1500 createSubscriber .then(data)=======>"
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,data=" + data);
+ subscriber1500 = data;
+ await commonEvent.subscribe(subscriber1500, async (err, data) => {
+ console.debug("=ACTS_JsServiceAbility_1500 subscribe (err,data)=======>"
+ + ("json err【") + JSON.stringify(err) + (" 】")
+ + ("json data【") + JSON.stringify(data) + (" 】")
+ + " ,err=" + err + " ,data=" + data);
+ if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
+ expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500").assertEqual(
+ data.event);
+ featureAbility.disconnectAbility(mConnIdJsPromise).then(() => {
+ }).catch(err => {
+ expect(".catch").assertEqual(err);
+ console.debug('ACTS_JsServiceAbility_1500==== mConnIdJsPromise='
+ + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise);
+ console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ }
+
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_JsServiceAbility_1500_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ unsubscribe("ACTS_JsServiceAbility_1500_unsubscribe", subscriber1500);
+ console.log('ACTS_JsServiceAbility_1500==== code='
+ + JSON.stringify(code) + " , " + code)
+ }
+
+ mConnIdJsPromise = featureAbility.connectAbility(
+ {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ action: "ServiceConnectService_1500",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } catch (err) {
+ expect("catch").assertEqual(err);
+ console.log('ACTS_JsServiceAbility_1500==== {
- router.back()
- })
- }
- .width('100%')
- .height('100%')
- }
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import router from '@system.router';
+
+@Entry
+@Component
+struct Second {
+ private content: string = "Second Page"
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text(`${this.content}`)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button() {
+ Text('back to index')
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }.type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .onClick(() => {
+ router.back()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts
index e59a8552d67443ce8bf1a8b05f82ffa7c38dd358..9ea5d45d127e44f894c22abcbf9695fa82b68cd2 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts
@@ -1,192 +1,192 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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";
-import particleAbility from '@ohos.ability.particleAbility'
-import featureAbility from '@ohos.ability.featureAbility'
-import commonEvent from '@ohos.commonEvent'
-var serversecond_bundleName = "com.amsst.stserviceabilityserversecond";
-var serversecond_abilityName = "com.amsst.stserviceabilityserversecond.ServiceAbility";
-var mConnIdJs;
-class StubTest extends rpc.RemoteObject {
- constructor(des) {
- console.info('ACTS_SerivceAbilityServer ====< des = ' + des);
- if (typeof des === 'string') {
- console.info('ACTS_ super');
- super(des);
- } else {
- return null;
- }
- }
-
- onRemoteRequest(code, data, reply, option) {
- if (code === 1) {
- console.info("ACTS_SerivceAbilityServer ====< onRemoteRequest code = 1");
- let token = data.readInterfaceToken();
- console.log('ACTS_SerivceAbilityServer ====< onRemoteRequest token:' + token);
- let num = data.readInt();
- console.log('ACTS_SerivceAbilityServer ====< onRemoteRequest num:' + num);
- this.method();
- num = num + 777;
- reply.writeInt(num);
- } else {
- console.info("ACTS_SerivceAbilityServer ====< onRemoteRequest code not 1");
- }
- return true;
- }
- method() {
- console.log('ACTS_SerivceAbilityServer ====< method called.')
- }
-}
-
-export default {
- onStart(want) {
- console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 ='
- + want + " , JSON." + JSON.stringify(want));
- commonEvent.publish("ACTS_SerivceAbilityServer_onStart", (err) => { });
- },
- onStop() {
- console.debug('ACTS_SerivceAbilityServer ==== { });
- featureAbility.terminateSelf();
- },
- onCommand(want, restart, startId) {
- console.debug('ACTS_SerivceAbilityServer ====>onCommand='
- + "JSON(want)=" + JSON.stringify(want)
- + " ,restart=" + restart + " ,startId=" + startId);
- if (want.action == 'ServiceStartService_0900') {
- particleAbility.startAbility(
- {
- want:
- {
- bundleName: serversecond_bundleName,
- abilityName: serversecond_abilityName,
- action: "ServiceStartService_0900",
- },
- }
- );
- featureAbility.terminateSelf();
- } else if (want.action == 'ServiceStartService_1000') {
- particleAbility.startAbility(
- {
- want:
- {
- bundleName: serversecond_bundleName,
- abilityName: serversecond_abilityName,
- action: "ServiceStartService_1000",
- },
- }, (err, data) => {
- console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback====='
- + err + ', data= ' + data + " , JSON." + JSON.stringify(data));
- featureAbility.terminateSelf();
- }
- );
- } else {
- commonEvent.publish("ACTS_SerivceAbilityServer_onCommand" + "_" + want.action, (err) => {
- if (!err.code) {
- if (want.action == 'PageStartService_0100' || want.action == 'PageStartService_0200'
- || want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') {
- console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.terminateSelf()=====>'
- + want.action);
- featureAbility.terminateSelf();
- }
- } else {
- console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err);
- }
- });
- }
- },
- onConnect(want) {
- console.info('ACTS_SerivceAbilityServer ====< onConnect');
- try {
- console.debug('ACTS_SerivceAbilityServer ====>onConnect='
- + want + " , JSON." + JSON.stringify(want));
- function onConnectCallback(element, remote) {
- console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> mConnIdJs='
- + JSON.stringify(mConnIdJs) + " , " + mConnIdJs);
- console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- }
- function onDisconnectCallback(element) {
- console.debug('ACTS_SerivceAbilityServer_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- }
- function onFailedCallback(code) {
- console.debug('ACTS_SerivceAbilityServer_onFailedCallback ====> code='
- + JSON.stringify(code) + " , " + code)
- }
- if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
- || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') {
- mConnIdJs = particleAbility.connectAbility(
- {
- bundleName: serversecond_bundleName,
- abilityName: serversecond_abilityName,
- action: want.action,
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } else {
- commonEvent.publish("ACTS_SerivceAbilityServer_onConnect" + "_" + want.action, (err) => { });
- }
- } catch (err) {
- console.log("ACTS_SerivceAbilityServer ====< error:" + err)
- }
- console.info('ACTS_SerivceAbilityServer ====< onConnect end');
- return new StubTest("connect-test");
- },
- onDisconnect(want) {
- console.debug('ACTS_SerivceAbilityServer ====>onDisConnect='
- + want + " , JSON." + JSON.stringify(want));
- commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect", (err) => {
- if (err.code) {
- console.debug('ACTS_SerivceAbilityServer_onDisConnect publish err=====>' + err);
- } else {
- console.debug('ACTS_SerivceAbilityServer_onDisConnect featureAbility.terminateSelf()=====<'
- + want.action);
- if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
- || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
- || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
- ) {
- particleAbility.disconnectAbility(mConnIdJs, (err) => {
- console.debug("=ACTS_SerivceAbilityServer_onDisConnect 13 14 15 16 err====>"
- + ("json err=") + JSON.stringify(err) + " , " + want.action);
- })
- }
- featureAbility.terminateSelf();
- }
- });
- },
- onReady() {
- console.debug('ACTS_SerivceAbilityServer ====onReconnect='
- + want + " , JSON." + JSON.stringify(want));
- commonEvent.publish("ACTS_SerivceAbilityServer_onReconnect" + "_" + want.action, (err) => { });
- },
- OnAbilityConnectDone(element, remoteObject, resultCode) {
- console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone='
- + element + " , JSON." + JSON.stringify(element)
- + remoteObject + " , JSON." + JSON.stringify(remoteObject)
- + resultCode + " , JSON." + JSON.stringify(resultCode)
- );
- commonEvent.publish("ACTS_SerivceAbilityServer_OnAbilityConnectDone", (err) => { });
- },
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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";
+import particleAbility from '@ohos.ability.particleAbility'
+import featureAbility from '@ohos.ability.featureAbility'
+import commonEvent from '@ohos.commonEvent'
+var serversecond_bundleName = "com.amsst.stserviceabilityserversecond";
+var serversecond_abilityName = "com.amsst.stserviceabilityserversecond.ServiceAbility";
+var mConnIdJs;
+class StubTest extends rpc.RemoteObject {
+ constructor(des) {
+ console.info('ACTS_SerivceAbilityServer ====< des = ' + des);
+ if (typeof des === 'string') {
+ console.info('ACTS_ super');
+ super(des);
+ } else {
+ return null;
+ }
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ if (code === 1) {
+ console.info("ACTS_SerivceAbilityServer ====< onRemoteRequest code = 1");
+ let token = data.readInterfaceToken();
+ console.log('ACTS_SerivceAbilityServer ====< onRemoteRequest token:' + token);
+ let num = data.readInt();
+ console.log('ACTS_SerivceAbilityServer ====< onRemoteRequest num:' + num);
+ this.method();
+ num = num + 777;
+ reply.writeInt(num);
+ } else {
+ console.info("ACTS_SerivceAbilityServer ====< onRemoteRequest code not 1");
+ }
+ return true;
+ }
+ method() {
+ console.log('ACTS_SerivceAbilityServer ====< method called.')
+ }
+}
+
+export default {
+ onStart(want) {
+ console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 ='
+ + want + " , JSON." + JSON.stringify(want));
+ commonEvent.publish("ACTS_SerivceAbilityServer_onStart", (err) => { });
+ },
+ onStop() {
+ console.debug('ACTS_SerivceAbilityServer ==== { });
+ featureAbility.terminateSelf();
+ },
+ onCommand(want, restart, startId) {
+ console.debug('ACTS_SerivceAbilityServer ====>onCommand='
+ + "JSON(want)=" + JSON.stringify(want)
+ + " ,restart=" + restart + " ,startId=" + startId);
+ if (want.action == 'ServiceStartService_0900') {
+ particleAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: serversecond_bundleName,
+ abilityName: serversecond_abilityName,
+ action: "ServiceStartService_0900",
+ },
+ }
+ );
+ featureAbility.terminateSelf();
+ } else if (want.action == 'ServiceStartService_1000') {
+ particleAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: serversecond_bundleName,
+ abilityName: serversecond_abilityName,
+ action: "ServiceStartService_1000",
+ },
+ }, (err, data) => {
+ console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback====='
+ + err + ', data= ' + data + " , JSON." + JSON.stringify(data));
+ featureAbility.terminateSelf();
+ }
+ );
+ } else {
+ commonEvent.publish("ACTS_SerivceAbilityServer_onCommand" + "_" + want.action, (err) => {
+ if (!err.code) {
+ if (want.action == 'PageStartService_0100' || want.action == 'PageStartService_0200'
+ || want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') {
+ console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.terminateSelf()=====>'
+ + want.action);
+ featureAbility.terminateSelf();
+ }
+ } else {
+ console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err);
+ }
+ });
+ }
+ },
+ onConnect(want) {
+ console.info('ACTS_SerivceAbilityServer ====< onConnect');
+ try {
+ console.debug('ACTS_SerivceAbilityServer ====>onConnect='
+ + want + " , JSON." + JSON.stringify(want));
+ function onConnectCallback(element, remote) {
+ console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> mConnIdJs='
+ + JSON.stringify(mConnIdJs) + " , " + mConnIdJs);
+ console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ }
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_SerivceAbilityServer_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ }
+ function onFailedCallback(code) {
+ console.debug('ACTS_SerivceAbilityServer_onFailedCallback ====> code='
+ + JSON.stringify(code) + " , " + code)
+ }
+ if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
+ || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') {
+ mConnIdJs = particleAbility.connectAbility(
+ {
+ bundleName: serversecond_bundleName,
+ abilityName: serversecond_abilityName,
+ action: want.action,
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } else {
+ commonEvent.publish("ACTS_SerivceAbilityServer_onConnect" + "_" + want.action, (err) => { });
+ }
+ } catch (err) {
+ console.log("ACTS_SerivceAbilityServer ====< error:" + err)
+ }
+ console.info('ACTS_SerivceAbilityServer ====< onConnect end');
+ return new StubTest("connect-test");
+ },
+ onDisconnect(want) {
+ console.debug('ACTS_SerivceAbilityServer ====>onDisConnect='
+ + want + " , JSON." + JSON.stringify(want));
+ commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect", (err) => {
+ if (err.code) {
+ console.debug('ACTS_SerivceAbilityServer_onDisConnect publish err=====>' + err);
+ } else {
+ console.debug('ACTS_SerivceAbilityServer_onDisConnect featureAbility.terminateSelf()=====<'
+ + want.action);
+ if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
+ || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
+ || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
+ ) {
+ particleAbility.disconnectAbility(mConnIdJs, (err) => {
+ console.debug("=ACTS_SerivceAbilityServer_onDisConnect 13 14 15 16 err====>"
+ + ("json err=") + JSON.stringify(err) + " , " + want.action);
+ })
+ }
+ featureAbility.terminateSelf();
+ }
+ });
+ },
+ onReady() {
+ console.debug('ACTS_SerivceAbilityServer ====onReconnect='
+ + want + " , JSON." + JSON.stringify(want));
+ commonEvent.publish("ACTS_SerivceAbilityServer_onReconnect" + "_" + want.action, (err) => { });
+ },
+ OnAbilityConnectDone(element, remoteObject, resultCode) {
+ console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone='
+ + element + " , JSON." + JSON.stringify(element)
+ + remoteObject + " , JSON." + JSON.stringify(remoteObject)
+ + resultCode + " , JSON." + JSON.stringify(resultCode)
+ );
+ commonEvent.publish("ACTS_SerivceAbilityServer_OnAbilityConnectDone", (err) => { });
+ },
};
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/resources/base/element/string.json
index bc26cd000f36f57d4f30f2710cdd08b6fc2d4c80..745bfaffc123f48189566fbfcbfe4e68bb6edb84 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/resources/base/element/string.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/resources/base/element/string.json
@@ -1,36 +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"
- }
- ]
+{
+ "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/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn
index 084688a51e3a1b18308d4bb9f904b8682c98bbbe..f697e063bdc63fdc93944b3ab778a00b17281967 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json
index 1f2dd9b9c9217152f3db47fb4996ef9cbc4ebf6d..7f51b6e226c3e39f401d6970cf0f9bdd59f1188b 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json
@@ -1,86 +1,86 @@
-{
- "app": {
- "bundleName": "com.amsst.stserviceabilityserversecond",
- "vendor": "test",
- "version": {
- "code": 1000110,
- "name": "1.1.1"
- },
- "apiVersion": {
- "compatible": 9,
- "target": 9
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.amsst.stserviceabilityserversecond",
- "name": ".MyApplication",
- "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",
- "formsEnabled": false,
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "standard"
- },
- {
- "srcPath": "ServiceAbility",
- "name": ".ServiceAbility",
- "icon": "$media:icon",
- "srcLanguage": "ets",
- "description": "$string:description_serviceability",
- "visible": true,
- "type": "service"
- }
- ],
- "js": [
- {
- "mode": {
- "syntax": "ets",
- "type": "pageAbility"
- },
- "pages": [
- "pages/index",
- "pages/second"
- ],
- "name": ".MainAbility",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ],
- "defPermissions": [
- {
- "name": "com.ohos.screenlock.DataAbilityShellProvider.PROVIDER"
- }
- ]
- }
-}
+{
+ "app": {
+ "bundleName": "com.amsst.stserviceabilityserversecond",
+ "vendor": "test",
+ "version": {
+ "code": 1000110,
+ "name": "1.1.1"
+ },
+ "apiVersion": {
+ "compatible": 9,
+ "target": 9
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.amsst.stserviceabilityserversecond",
+ "name": ".MyApplication",
+ "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",
+ "formsEnabled": false,
+ "label": "$string:entry_MainAbility",
+ "type": "page",
+ "launchType": "standard"
+ },
+ {
+ "srcPath": "ServiceAbility",
+ "name": ".ServiceAbility",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability",
+ "visible": true,
+ "type": "service"
+ }
+ ],
+ "js": [
+ {
+ "mode": {
+ "syntax": "ets",
+ "type": "pageAbility"
+ },
+ "pages": [
+ "pages/index",
+ "pages/second"
+ ],
+ "name": ".MainAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "defPermissions": [
+ {
+ "name": "com.ohos.screenlock.DataAbilityShellProvider.PROVIDER"
+ }
+ ]
+ }
+}
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/AbilityStage.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/AbilityStage.ts
index e2e06d6d3bddbd886d2f6554f50021d73235cfcc..07ad14f5f75a15d1a7cce6eaee825e65d58e5752 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/AbilityStage.ts
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/AbilityStage.ts
@@ -1,21 +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.AbilityStage"
-
-export default class MyAbilityStage extends AbilityStage {
- onCreate() {
- console.log("MyAbilityStage onCreate");
- }
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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");
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts
index 48dc2b68bb2018b7207d57d71e9e4daa4342a5ea..1dbbb8be4fa3479ff255de59bc442ee1c79bcfd6 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts
@@ -1,30 +1,30 @@
-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(){
-
- }
+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/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/app.ets
index eef2fff6d169b8c305daa2acd8db6eb913b31f4e..d0d2a5cd47ed5a1092788289ae2a48953d89be88 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/app.ets
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/app.ets
@@ -1,22 +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.
- */
-export default {
- onCreate() {
- console.info('Application onCreate')
- },
- onDestroy() {
- console.info('Application onDestroy')
- },
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/index.ets
index 6b4120bd91a94160e64b02ba8b7b89b413c39389..a8919c82aee6af5b231acdd2a2c6f6237a79f7d9 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/index.ets
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/index.ets
@@ -1,38 +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 {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%')
- }
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/second.ets b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/second.ets
index 65bb9463e1707757f7cb1cdca3d1b7da5dc63170..359eb5ab9c068706363fa2938cccd40d7df25264 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/second.ets
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/MainAbility/pages/second.ets
@@ -1,43 +1,43 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import router from '@system.router';
-
-@Entry
-@Component
-struct Second {
- private content: string = "Second Page"
-
- build() {
- Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
- Text(`${this.content}`)
- .fontSize(50)
- .fontWeight(FontWeight.Bold)
- Button() {
- Text('back to index')
- .fontSize(20)
- .fontWeight(FontWeight.Bold)
- }.type(ButtonType.Capsule)
- .margin({
- top: 20
- })
- .backgroundColor('#0D9FFB')
- .onClick(() => {
- router.back()
- })
- }
- .width('100%')
- .height('100%')
- }
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import router from '@system.router';
+
+@Entry
+@Component
+struct Second {
+ private content: string = "Second Page"
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text(`${this.content}`)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button() {
+ Text('back to index')
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }.type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .onClick(() => {
+ router.back()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts
index fde7bee833d25cafa64044e7775f472338b4f7d3..aa8acf0bdbbd97a5ae2fc53d3e7d5cb186bb9228 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts
@@ -1,183 +1,183 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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";
-import particleAbility from '@ohos.ability.particleAbility'
-import featureAbility from '@ohos.ability.featureAbility'
-import commonEvent from '@ohos.commonEvent'
-var server_bundleName = "com.amsst.stserviceabilityserver";
-var server_abilityName = "com.amsst.stserviceabilityserver.ServiceAbility";
-var mConnIdJs;
-class StubTest extends rpc.RemoteObject {
- constructor(des) {
- console.info('ACTS_SerivceAbilityServerSecond ====< des = ' + des);
- if (typeof des === 'string') {
- console.info('ACTS_ super');
- super(des);
- } else {
- return null;
- }
- }
-
- onRemoteRequest(code, data, reply, option) {
- if (code === 1) {
- console.info("ACTS_SerivceAbilityServerSecond ====< onRemoteRequest code = 1");
- let token = data.readInterfaceToken();
- console.log('ACTS_SerivceAbilityServerSecond ====< onRemoteRequest token:' + token);
- let num = data.readInt();
- console.log('ACTS_SerivceAbilityServerSecond ====< onRemoteRequest num:' + num);
- this.method();
- num = num + 777;
- reply.writeInt(num);
- } else {
- console.info("ACTS_SerivceAbilityServerSecond ====< onRemoteRequest code not 1");
- }
- return true;
- }
- method() {
- console.log('ACTS_SerivceAbilityServerSecond ====< method called.')
- }
-}
-
-export default {
- onStart(want) {
- console.debug('ACTS_SerivceAbilityServerSecond ====>onStart='
- + want + " , JSON." + JSON.stringify(want));
- commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStart", (err) => { });
- },
- onStop() {
- console.debug('ACTS_SerivceAbilityServerSecond ==== { });
- featureAbility.terminateSelf();
- },
- onCommand(want, restart, startId) {
- console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand='
- + "JSON(want)=" + JSON.stringify(want)
- + " ,restart=" + restart + " ,startId=" + startId);
- commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { });
- featureAbility.terminateSelf();
- },
- onConnect(want) {
- console.info('ACTS_SerivceAbilityServerSecond ====< onConnect');
- try {
- console.debug('ACTS_SerivceAbilityServerSecond ====>onConnect='
- + want + " , JSON." + JSON.stringify(want));
- function onConnectCallback(element, remote) {
- console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action='
- + JSON.stringify(want.action) + " , " + want.action);
- console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote='
- + JSON.stringify(remote) + " , " + remote);
- if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') {
- commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => {
- console.debug("publish = ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action);
- });
- }
- }
-
- function onDisconnectCallback(element) {
- console.debug('ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element='
- + JSON.stringify(element) + " , " + element);
- }
-
- function onFailedCallback(code) {
- console.debug('ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code='
- + JSON.stringify(code) + " , " + code)
- }
- if (want.action == 'ServiceConnectService_1500') {
- mConnIdJs = particleAbility.connectAbility(
- {
- bundleName: server_bundleName,
- abilityName: server_abilityName,
- action: "ServiceConnectService_1501",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } else if (want.action == 'ServiceConnectService_1600') {
- mConnIdJs = particleAbility.connectAbility(
- {
- bundleName: server_bundleName,
- abilityName: server_abilityName,
- action: "ServiceConnectService_1601",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } else if (want.action == 'ServiceConnectService_1590') {
- mConnIdJs = particleAbility.connectAbility(
- {
- bundleName: server_bundleName,
- abilityName: server_abilityName,
- action: "ServiceConnectService_1591",
- },
- {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback,
- onFailed: onFailedCallback,
- },
- )
- } else {
- commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => { });
- }
- } catch (err) {
- console.log("ACTS_SerivceAbilityServerSecond ====< error:" + err)
- }
- console.info('ACTS_SerivceAbilityServerSecond ====< onConnect end');
- return new StubTest("connect-test");
- },
- onDisconnect(want) {
- console.debug('ACTS_SerivceAbilityServerSecond ====>onDisConnect='
- + want + " , JSON." + JSON.stringify(want));
- commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect", (err) => {
- if (err.code) {
- console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err);
- } else {
- console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect featureAbility.terminateSelf()=====<'
- + want.action);
- if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
- || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
- || want.action == 'ServiceConnectService_1590') {
- particleAbility.disconnectAbility(mConnIdJs, (err) => {
- console.debug("=ACTS_SerivceAbilityServerSecond_onDisConnect err====>"
- + ("json err=") + JSON.stringify(err) + " , " + want.action);
- })
- }
- featureAbility.terminateSelf();
- }
- });
- },
- onReady() {
- console.debug('ACTS_SerivceAbilityServerSecond ====onReconnect='
- + want + " , JSON." + JSON.stringify(want));
- },
- OnAbilityConnectDone(element, remoteObject, resultCode) {
- console.debug('ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone='
- + element + " , JSON." + JSON.stringify(element)
- + remoteObject + " , JSON." + JSON.stringify(remoteObject)
- + resultCode + " , JSON." + JSON.stringify(resultCode)
- );
- commonEvent.publish("ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone", (err) => { });
- },
-};
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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";
+import particleAbility from '@ohos.ability.particleAbility'
+import featureAbility from '@ohos.ability.featureAbility'
+import commonEvent from '@ohos.commonEvent'
+var server_bundleName = "com.amsst.stserviceabilityserver";
+var server_abilityName = "com.amsst.stserviceabilityserver.ServiceAbility";
+var mConnIdJs;
+class StubTest extends rpc.RemoteObject {
+ constructor(des) {
+ console.info('ACTS_SerivceAbilityServerSecond ====< des = ' + des);
+ if (typeof des === 'string') {
+ console.info('ACTS_ super');
+ super(des);
+ } else {
+ return null;
+ }
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ if (code === 1) {
+ console.info("ACTS_SerivceAbilityServerSecond ====< onRemoteRequest code = 1");
+ let token = data.readInterfaceToken();
+ console.log('ACTS_SerivceAbilityServerSecond ====< onRemoteRequest token:' + token);
+ let num = data.readInt();
+ console.log('ACTS_SerivceAbilityServerSecond ====< onRemoteRequest num:' + num);
+ this.method();
+ num = num + 777;
+ reply.writeInt(num);
+ } else {
+ console.info("ACTS_SerivceAbilityServerSecond ====< onRemoteRequest code not 1");
+ }
+ return true;
+ }
+ method() {
+ console.log('ACTS_SerivceAbilityServerSecond ====< method called.')
+ }
+}
+
+export default {
+ onStart(want) {
+ console.debug('ACTS_SerivceAbilityServerSecond ====>onStart='
+ + want + " , JSON." + JSON.stringify(want));
+ commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStart", (err) => { });
+ },
+ onStop() {
+ console.debug('ACTS_SerivceAbilityServerSecond ==== { });
+ featureAbility.terminateSelf();
+ },
+ onCommand(want, restart, startId) {
+ console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand='
+ + "JSON(want)=" + JSON.stringify(want)
+ + " ,restart=" + restart + " ,startId=" + startId);
+ commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { });
+ featureAbility.terminateSelf();
+ },
+ onConnect(want) {
+ console.info('ACTS_SerivceAbilityServerSecond ====< onConnect');
+ try {
+ console.debug('ACTS_SerivceAbilityServerSecond ====>onConnect='
+ + want + " , JSON." + JSON.stringify(want));
+ function onConnectCallback(element, remote) {
+ console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action='
+ + JSON.stringify(want.action) + " , " + want.action);
+ console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote='
+ + JSON.stringify(remote) + " , " + remote);
+ if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') {
+ commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => {
+ console.debug("publish = ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action);
+ });
+ }
+ }
+
+ function onDisconnectCallback(element) {
+ console.debug('ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element='
+ + JSON.stringify(element) + " , " + element);
+ }
+
+ function onFailedCallback(code) {
+ console.debug('ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code='
+ + JSON.stringify(code) + " , " + code)
+ }
+ if (want.action == 'ServiceConnectService_1500') {
+ mConnIdJs = particleAbility.connectAbility(
+ {
+ bundleName: server_bundleName,
+ abilityName: server_abilityName,
+ action: "ServiceConnectService_1501",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } else if (want.action == 'ServiceConnectService_1600') {
+ mConnIdJs = particleAbility.connectAbility(
+ {
+ bundleName: server_bundleName,
+ abilityName: server_abilityName,
+ action: "ServiceConnectService_1601",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } else if (want.action == 'ServiceConnectService_1590') {
+ mConnIdJs = particleAbility.connectAbility(
+ {
+ bundleName: server_bundleName,
+ abilityName: server_abilityName,
+ action: "ServiceConnectService_1591",
+ },
+ {
+ onConnect: onConnectCallback,
+ onDisconnect: onDisconnectCallback,
+ onFailed: onFailedCallback,
+ },
+ )
+ } else {
+ commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => { });
+ }
+ } catch (err) {
+ console.log("ACTS_SerivceAbilityServerSecond ====< error:" + err)
+ }
+ console.info('ACTS_SerivceAbilityServerSecond ====< onConnect end');
+ return new StubTest("connect-test");
+ },
+ onDisconnect(want) {
+ console.debug('ACTS_SerivceAbilityServerSecond ====>onDisConnect='
+ + want + " , JSON." + JSON.stringify(want));
+ commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect", (err) => {
+ if (err.code) {
+ console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err);
+ } else {
+ console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect featureAbility.terminateSelf()=====<'
+ + want.action);
+ if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
+ || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
+ || want.action == 'ServiceConnectService_1590') {
+ particleAbility.disconnectAbility(mConnIdJs, (err) => {
+ console.debug("=ACTS_SerivceAbilityServerSecond_onDisConnect err====>"
+ + ("json err=") + JSON.stringify(err) + " , " + want.action);
+ })
+ }
+ featureAbility.terminateSelf();
+ }
+ });
+ },
+ onReady() {
+ console.debug('ACTS_SerivceAbilityServerSecond ====onReconnect='
+ + want + " , JSON." + JSON.stringify(want));
+ },
+ OnAbilityConnectDone(element, remoteObject, resultCode) {
+ console.debug('ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone='
+ + element + " , JSON." + JSON.stringify(element)
+ + remoteObject + " , JSON." + JSON.stringify(remoteObject)
+ + resultCode + " , JSON." + JSON.stringify(resultCode)
+ );
+ commonEvent.publish("ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone", (err) => { });
+ },
+};
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/resources/base/element/string.json
index bc26cd000f36f57d4f30f2710cdd08b6fc2d4c80..745bfaffc123f48189566fbfcbfe4e68bb6edb84 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/resources/base/element/string.json
+++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/resources/base/element/string.json
@@ -1,36 +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"
- }
- ]
+{
+ "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/ability/ability_runtime/want/BUILD.gn b/ability/ability_runtime/want/BUILD.gn
index fe2d26693b0b09e1ff0692fcb2e86a18608d5e31..815bea294b3aacd103f1a4ffea3117225f5dc0e8 100644
--- a/ability/ability_runtime/want/BUILD.gn
+++ b/ability/ability_runtime/want/BUILD.gn
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
diff --git a/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn b/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn
index 9d108f99cfeafa49eb5273950171d1f64e02f5f0..0720cfc6bd947135d5139266fc62316e7403b17b 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn
+++ b/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn
@@ -9,12 +9,12 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsGetWantAllTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsGetWantAllTest") {
hap_name = "ActsGetWantAllTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/want/actsgetwantalltest/Test.json b/ability/ability_runtime/want/actsgetwantalltest/Test.json
index ff1ff4ee74ea9078394ecd7f20337774ff5a5343..04e3c084f16d4c1de0d6614528806f963dc022cb 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/Test.json
+++ b/ability/ability_runtime/want/actsgetwantalltest/Test.json
@@ -1,19 +1,20 @@
-{
- "description": "Configuration for hjunit demo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "600000",
- "package": "com.example.actsgetwantalltest",
- "shell-timeout": "600000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsGetWantAllTest.hap",
- "ActsGetWantAllTestHap.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "600000",
+ "bundle-name": "com.example.actsgetwantalltest",
+ "package-name": "com.example.actsgetwantalltest",
+ "shell-timeout": "600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsGetWantAllTest.hap",
+ "ActsGetWantAllTestHap.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/config.json b/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/config.json
deleted file mode 100644
index 9d87d55bca768f02b6e1b881578a206c47501d7e..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/config.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.actsgetwantalltest",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.actsgetwantalltest",
- "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.actsgetwantalltest.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/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
deleted file mode 100644
index 2f9470d82c49675a64972657d8d367cd95e51c63..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/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/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..efa31c7362fe6bbf13d3b4893aa1ea545a2238c6
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json
@@ -0,0 +1,116 @@
+{
+ "app": {
+ "bundleName": "com.example.actsgetwantalltest",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.actsgetwantalltest",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "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
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "mainAbility": ".MainAbility",
+ "srcPath": ""
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/app.js b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..ef51f1d575c958d1cb3ec124b85d1dd1937b5bca
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/app.js
@@ -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.
+ */
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
+
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/i18n/en-US.json
similarity index 91%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/i18n/en-US.json
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/i18n/en-US.json
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/i18n/en-US.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 91%
rename from ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/i18n/zh-CN.json
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984 100644
--- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/entry/src/main/js/default/i18n/zh-CN.json
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/i18n/zh-CN.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.css
similarity index 93%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.css
index 6fda792753f2e15f22b529c7b90a82185b2770bf..5c52a87a04f583e9d5f4db1dd40d4eafdb9b6aeb 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.css
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.css
@@ -1,9 +1,9 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.hml b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.js
similarity index 67%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.js
index 933aff0597a44bb899a1579f3f830fc62f9ba403..aede94a474bd66072770ef9fe40526a349c2be41 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/default/pages/index/index.js
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/MainAbility/pages/index/index.js
@@ -1,50 +1,42 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- id: 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../../../test/List.test'
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/app.js b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..875191631733a62e2bdff76d6b5a2e2f1b130937
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/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/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.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;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+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', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/test/ActsGetWantAllTest.js
similarity index 97%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/js/test/ActsGetWantAllTest.js
index a5163aa63f6f50f3da2263d2cd4d4d052463b2b4..aec8fdb2069d695a94360522ece2a528d0bd3905 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/test/ActsGetWantAllTest.js
@@ -1,1425 +1,1427 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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()
- })
-})
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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 '@ohos/hypium'
+export default function ActsGetWantTest() {
+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/src/main/js/test/List.test.js
similarity index 81%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/List.test.js
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/js/test/List.test.js
index b09ec7c7b7f982f7f0d834f5c03b9544bea2736f..1b4ed4c24c5534ef3eabbe5944f14a4d4382285b 100644
--- a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/test/List.test.js
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/js/test/List.test.js
@@ -1,16 +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.
- */
-
-require('./ActsGetWantAllTest.js')
\ No newline at end of file
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsGetWantTest from './ActsGetWantAllTest.js'
+
+export default function testsuite() {
+ ActsGetWantTest()
+}
diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/resources/base/element/string.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..37616f87511546d3e002782ef19ac7c0e014d2ee
--- /dev/null
+++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "MyApplication"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/want/actsgetwantalltest/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/want/actsgetwantalltest/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/want/actsgetwantalltest/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json
index d94c640eba2f13aee600cd518d9ecfe5aeabe4e1..cee293b11598b0b884db050de54cbf9b935ae6bd 100644
--- a/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json
+++ b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json
@@ -1,83 +1,83 @@
-{
- "app": {
- "bundleName": "com.example.actsgetwantalltesthap",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.actsgetwantallhap",
- "name": "com.example.actsgetwantalltesthap.MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actsgetwantalltesthap.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard",
- "visible": true
- }
- ],
- "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
- }
- }
- ]
- }
+{
+ "app": {
+ "bundleName": "com.example.actsgetwantalltesthap",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.actsgetwantallhap",
+ "name": "com.example.actsgetwantalltesthap.MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.example.actsgetwantalltesthap.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard",
+ "visible": true
+ }
+ ],
+ "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/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/js/default/app.js
index 8e47afff13e928a74fdcc01a108e4422404b9ac9..2ba842eda9d2f61221fca73dfb53c2a2903fc3e4 100644
--- 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
@@ -1,23 +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');
- }
-};
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/ability/ability_runtime/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
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 100644
--- a/ability/ability_runtime/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
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/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
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984 100644
--- a/ability/ability_runtime/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
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
}
\ No newline at end of file
diff --git a/ability/ability_runtime/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
index 6fda792753f2e15f22b529c7b90a82185b2770bf..5c52a87a04f583e9d5f4db1dd40d4eafdb9b6aeb 100644
--- a/ability/ability_runtime/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
@@ -1,9 +1,9 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/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
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..f629c71a9be857db6cdf94149652a191b9b272ea 100644
--- a/ability/ability_runtime/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
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/ability/ability_runtime/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
index 510a67390f12569e4cfcb45f4b780930025fb849..f6c5574223ddf8ce71acc1352dc73332c3d9ba47 100644
--- a/ability/ability_runtime/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
@@ -1,63 +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 featureAbility from '@ohos.ability.featureAbility'
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('============Start Ability onShow finish');
-
- featureAbility.getWant(
- (err, data) => {
- data = data;
- console.debug("==========data=" + JSON.stringify(data));
- if (data.parameters.mykey5[1] == 'test123'){
- featureAbility.getWant().then((data) =>{
- data = data
- setTimeout(function(){
- console.debug("==========data2 bundleName is==========="
- + JSON.stringify(data.bundleName));
- featureAbility.terminateSelfWithResult(
- {
- resultCode: 1,
- want: data
- }
- );
- },1000);
- })
- }else{
- setTimeout(function(){
- console.debug("==========data1 bundleName is==========="
- + JSON.stringify(data.bundleName));
- featureAbility.terminateSelfWithResult(
- {
- resultCode: 1,
- want: data
- }
- );
- },1000);
- }
- }
- )
- },
- onReady() {
- console.info('onReady');
- },
-}
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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'
+
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('============Start Ability onShow finish');
+
+ featureAbility.getWant(
+ (err, data) => {
+ data = data;
+ console.debug("==========data=" + JSON.stringify(data));
+ if (data.parameters.mykey5[1] == 'test123'){
+ featureAbility.getWant().then((data) =>{
+ data = data
+ setTimeout(function(){
+ console.debug("==========data2 bundleName is==========="
+ + JSON.stringify(data.bundleName));
+ featureAbility.terminateSelfWithResult(
+ {
+ resultCode: 1,
+ want: data
+ }
+ );
+ },1000);
+ })
+ }else{
+ setTimeout(function(){
+ console.debug("==========data1 bundleName is==========="
+ + JSON.stringify(data.bundleName));
+ featureAbility.terminateSelfWithResult(
+ {
+ resultCode: 1,
+ want: data
+ }
+ );
+ },1000);
+ }
+ }
+ )
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
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
index 2f9470d82c49675a64972657d8d367cd95e51c63..d405647b90183b99fb4e15025a9fe12c85c495d4 100644
--- 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
@@ -1,12 +1,12 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "MyApplication"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "MyApplication"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
}
\ No newline at end of file