diff --git a/distributedschedule/BUILD.gn b/distributedschedule/BUILD.gn
index de81fd254d4aca50534e170ffb9072471405ffa8..c2478d43058a75069f49ff643578fa8d73e2bc10 100644
--- a/distributedschedule/BUILD.gn
+++ b/distributedschedule/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("//build/ohos_var.gni")
diff --git a/distributedschedule/dmsfwk/BUILD.gn b/distributedschedule/dmsfwk/BUILD.gn
index 44cc84825e2852ef3165edf34d24da2db42ee4d5..bf5ae7cc6a6b9d131590e16ce205f6d02cc21e84 100644
--- a/distributedschedule/dmsfwk/BUILD.gn
+++ b/distributedschedule/dmsfwk/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("//build/ohos_var.gni")
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/BUILD.gn b/distributedschedule/dmsfwk/continuationmanagertest/BUILD.gn
index c3bf176b7a62f9e55469b51217cf8e67baa3636c..2ce221458a27527b354423fb7678d81b4f488d5e 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/BUILD.gn
+++ b/distributedschedule/dmsfwk/continuationmanagertest/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("continuationmanager_js_test") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":continuationmanager_js_assets",
":continuationmanager_resources",
@@ -23,9 +23,11 @@ ohos_js_hap_suite("continuationmanager_js_test") {
hap_name = "ActsContinuationManagerJsTest"
}
ohos_js_assets("continuationmanager_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("continuationmanager_resources") {
- sources = [ "./entry/src/main/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/Test.json b/distributedschedule/dmsfwk/continuationmanagertest/Test.json
index 933625ec530d83b87c0cf32f9ad3c13a860e9327..7104e0ef7c00a5c259c78829d4600437e0bc4343 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/Test.json
+++ b/distributedschedule/dmsfwk/continuationmanagertest/Test.json
@@ -1,18 +1,19 @@
-{
- "description": "Configuration for hjunit demo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "1200000",
- "package": "ohos.acts.distributedschedule.continuationmanager",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsContinuationManagerJsTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "1200000",
+ "shell-timeout": "1200000",
+ "bundle-name": "ohos.acts.distributedschedule.continuationmanager",
+ "package-name": "ohos.acts.distributedschedule.continuationmanager"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsContinuationManagerJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/config.json b/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/config.json
deleted file mode 100644
index ab20c3060abeb1a11327c5cbe29232220853ebe6..0000000000000000000000000000000000000000
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/config.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "app": {
- "bundleName": "ohos.acts.distributedschedule.continuationmanager",
- "vendor": "example",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "ohos.acts.distributedschedule.continuationmanager",
- "name": ".MyApplication",
- "mainAbility": "ohos.acts.distributedschedule.continuationmanager.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": false
- },
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "ohos.acts.distributedschedule.continuationmanager.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/resources/base/element/string.json b/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/resources/base/element/string.json
deleted file mode 100644
index 2d49e6106584408fb817315f5def3daa5a8c0845..0000000000000000000000000000000000000000
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "ContinuationManagerJsTest"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/config.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..73664228baca03b9cd85ed6d2e4a22fcfcae8b9e
--- /dev/null
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/config.json
@@ -0,0 +1,94 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.distributedschedule.continuationmanager",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.distributedschedule.continuationmanager",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "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"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "srcPath": ""
+ }
+}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/app.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/app.js
similarity index 97%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/app.js
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/app.js
index 5fd779278aabed8968c31b4819249810085b00c7..3a41e590ec6d582abedac2821eb54bf9aad77dd4 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/app.js
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/app.js
@@ -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('TestApplication onCreate');
- },
- onDestroy() {
- console.info('TestApplication 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('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/en-US.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/en-US.json
similarity index 91%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/en-US.json
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/en-US.json
index 55561b83737c3c31d082fbfa11e5fc987a351104..3cb24b374b1d919ca8eac0638f361692b603a900 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/en-US.json
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/en-US.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/zh-CN.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 91%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/zh-CN.json
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/zh-CN.json
index cce1af06761a42add0cac1a0567aa3237eda8cb4..c804e32c0c3103929baca5617cdac70be11fdba1 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/i18n/zh-CN.json
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/zh-CN.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.css b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.css
similarity index 96%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.css
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.css
index 1beb14afd6c9ff1a700f6e9dbbd795da627c538c..0eb1086016dbb3adcbaed911f027264630f12993 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.css
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.css
@@ -1,23 +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.
-*/
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
+/*
+* Copyright (c) 2022 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.hml b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.hml
similarity index 97%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.hml
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.hml
index 11314b6392759e0beaaa8c7f59370b1fd0e8df10..2a54c0734ed9fa2b56dcd7bdcb282ba0477c90fd 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.hml
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.hml
@@ -1,20 +1,20 @@
-/*
-* Copyright (c) 2022 Huawei Device Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
- {{ $t('strings.hello') }} {{title}}
-
-
+/*
+* Copyright (c) 2022 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.js
similarity index 85%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.js
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.js
index e8d7ef0b07ac23c309febd3e2ed83e941fc0cbc8..bd4cb14f07d97ea29445efd49882eab0c698f263 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/pages/index/index.js
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.js
@@ -1,36 +1,31 @@
-/*
-* Copyright (c) 2022 Huawei Device Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES 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'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- core.init()
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
+/*
+* Copyright (c) 2022 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/app.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/i18n/en-US.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/en-US.json
similarity index 91%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/i18n/en-US.json
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/en-US.json
index 55561b83737c3c31d082fbfa11e5fc987a351104..3cb24b374b1d919ca8eac0638f361692b603a900 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/i18n/en-US.json
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/en-US.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/zh-CN.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/zh-CN.json
similarity index 91%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/zh-CN.json
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/zh-CN.json
index cce1af06761a42add0cac1a0567aa3237eda8cb4..c804e32c0c3103929baca5617cdac70be11fdba1 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/zh-CN.json
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.css b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/distributedschedule/dmsfwk/continuationmanagertest/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.hml b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.hml
similarity index 95%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.hml
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..f629c71a9be857db6cdf94149652a191b9b272ea 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.hml
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.hml
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/distributedschedule/dmsfwk/continuationmanagertest/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/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/distributedschedule/dmsfwk/continuationmanagertest/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'] + '.TestAbility'
+
+ 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/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/test/ContinuationManagerJsunit.test.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js
similarity index 96%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/test/ContinuationManagerJsunit.test.js
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js
index 41b974f7fabdd8e689d28ec9b4009bd1fb85639b..070a1527bfa01178f3de5e1265596b15ee1d95a3 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/test/ContinuationManagerJsunit.test.js
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js
@@ -1,268 +1,269 @@
-/*
- * Copyright (c) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-import continuationManager from '@ohos.continuation.continuationManager';
-
-const TEST_DEVICE_ID = "test_deviceId";
-const TEST_CONNECT_STATUS = continuationManager.DeviceConnectState.CONNECTED;
-let token = -1;
-
-describe('ContinuationManagerTest', function() {
-
- beforeAll(async function (done) {
- console.info('beforeAll');
- done();
- })
-
- afterAll(async function (done) {
- console.info('afterAll');
- done();
- })
-
- beforeEach(async function (done) {
- console.info('beforeEach');
- await continuationManager.register(function (err, data) {
- token = data;
- console.info('beforeEach register success');
- done();
- });
- console.info('beforeEach end');
- })
-
- afterEach(async function (done) {
- console.info('afterEach');
- await continuationManager.unregister(token, function (err, data) {
- console.info('afterEach unregister success');
- done();
- });
- console.info('afterEach end');
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0100
- * @tc.name [JS-API8]ContinuationManager.register().
- * @tc.desc Test Js Api ContinuationManager.register() testcase 001
- */
- it('testRegister001', 0, async function(done) {
- try {
- continuationManager.register(function (err, data) {
- expect(err.code == 0).assertTrue();
- expect(data - token == 1).assertTrue();
- done();
- });
- } catch (e) {
- console.info("testRegister001 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0100
- * @tc.name [JS-API8]ContinuationManager.unregister().
- * @tc.desc Test Js Api ContinuationManager.unregister() testcase 001
- */
- it('testUnregister001', 0, async function(done) {
- try {
- continuationManager.unregister(token, function (err, data) {
- expect(err.code == 0).assertTrue();
- expect(data == undefined).assertTrue();
- })
- done();
- } catch (e) {
- console.info("testUnregister001 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0100
- * @tc.name [JS-API8]ContinuationManager.on().
- * @tc.desc Test Js Api ContinuationManager.on() testcase 001
- */
- it('testOn001', 0, async function(done) {
- try {
- continuationManager.on("deviceConnect", function (data) {
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testOn001 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0200
- * @tc.name [JS-API8]ContinuationManager.on().
- * @tc.desc Test Js Api ContinuationManager.on() testcase 002
- */
- it('testOn002', 0, async function(done) {
- try {
- continuationManager.on("deviceDisconnect", function (data) {
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testOn002 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0300
- * @tc.name [JS-API9]ContinuationManager.on().
- * @tc.desc Test Js Api ContinuationManager.on() testcase 003
- */
- it('testOn003', 0, async function(done) {
- try {
- continuationManager.on("deviceConnect", token, function (data) {
- expect(data == undefined).assertTrue();
- })
- done();
- } catch (e) {
- console.info("testOn003 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0400
- * @tc.name [JS-API9]ContinuationManager.on().
- * @tc.desc Test Js Api ContinuationManager.on() testcase 004
- */
- it('testOn004', 0, async function(done) {
- try {
- continuationManager.on("deviceDisconnect", token, function (data) {
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testOn004 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0100
- * @tc.name [JS-API8]ContinuationManager.off().
- * @tc.desc Test Js Api ContinuationManager.off() testcase 001
- */
- it('testOff001', 0, async function(done) {
- try {
- continuationManager.off("deviceConnect", function (data) {
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testOff001 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0200
- * @tc.name [JS-API8]ContinuationManager.off().
- * @tc.desc Test Js Api ContinuationManager.off() testcase 002
- */
- it('testOff002', 0, async function(done) {
- try {
- continuationManager.off("deviceDisconnect", function (data) {
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testOff002 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0300
- * @tc.name [JS-API9]ContinuationManager.off().
- * @tc.desc Test Js Api ContinuationManager.off() testcase 003
- */
- it('testOff003', 0, async function(done) {
- try {
- continuationManager.off("deviceConnect", token);
- done();
- } catch (e) {
- console.info("testOff003 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0400
- * @tc.name [JS-API9]ContinuationManager.off().
- * @tc.desc Test Js Api ContinuationManager.off() testcase 004
- */
- it('testOff004', 0, async function(done) {
- try {
- continuationManager.off("deviceDisconnect", token);
- done();
- } catch (e) {
- console.info("testOff004 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0100
- * @tc.name [JS-API8]ContinuationManager.startDeviceManager().
- * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 001
- */
- it('testStartDeviceManager001', 0, async function(done) {
- try {
- continuationManager.startDeviceManager(token, function (err, data) {
- expect(err.code != 0).assertTrue();
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testStartDeviceManager001 " + e);
- expect(null).assertFail();
- done();
- }
- })
-
- /**
- * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0100
- * @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
- * @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 001
- */
- it('testUpdateConnectStatus001', 0, async function(done) {
- try {
- continuationManager.updateConnectStatus(token, TEST_DEVICE_ID, TEST_CONNECT_STATUS, function (err, data) {
- expect(err.code != 0).assertTrue();
- expect(data == undefined).assertTrue();
- });
- done();
- } catch (e) {
- console.info("testUpdateConnectStatus001 " + e);
- expect(null).assertFail();
- done();
- }
- })
-})
\ No newline at end of file
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+import continuationManager from '@ohos.continuation.continuationManager';
+
+const TEST_DEVICE_ID = "test_deviceId";
+const TEST_CONNECT_STATUS = continuationManager.DeviceConnectState.CONNECTED;
+let token = -1;
+
+export default function ContinuationManagerTest() {
+describe('ContinuationManagerTest', function() {
+
+ beforeAll(async function (done) {
+ console.info('beforeAll');
+ done();
+ })
+
+ afterAll(async function (done) {
+ console.info('afterAll');
+ done();
+ })
+
+ beforeEach(async function (done) {
+ console.info('beforeEach');
+ await continuationManager.register(function (err, data) {
+ token = data;
+ console.info('beforeEach register success');
+ done();
+ });
+ console.info('beforeEach end');
+ })
+
+ afterEach(async function (done) {
+ console.info('afterEach');
+ await continuationManager.unregister(token, function (err, data) {
+ console.info('afterEach unregister success');
+ done();
+ });
+ console.info('afterEach end');
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0100
+ * @tc.name [JS-API8]ContinuationManager.register().
+ * @tc.desc Test Js Api ContinuationManager.register() testcase 001
+ */
+ it('testRegister001', 0, async function(done) {
+ try {
+ continuationManager.register(function (err, data) {
+ expect(err.code == 0).assertTrue();
+ expect(data - token == 1).assertTrue();
+ done();
+ });
+ } catch (e) {
+ console.info("testRegister001 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0100
+ * @tc.name [JS-API8]ContinuationManager.unregister().
+ * @tc.desc Test Js Api ContinuationManager.unregister() testcase 001
+ */
+ it('testUnregister001', 0, async function(done) {
+ try {
+ continuationManager.unregister(token, function (err, data) {
+ expect(err.code == 0).assertTrue();
+ expect(data == undefined).assertTrue();
+ })
+ done();
+ } catch (e) {
+ console.info("testUnregister001 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0100
+ * @tc.name [JS-API8]ContinuationManager.on().
+ * @tc.desc Test Js Api ContinuationManager.on() testcase 001
+ */
+ it('testOn001', 0, async function(done) {
+ try {
+ continuationManager.on("deviceConnect", function (data) {
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testOn001 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0200
+ * @tc.name [JS-API8]ContinuationManager.on().
+ * @tc.desc Test Js Api ContinuationManager.on() testcase 002
+ */
+ it('testOn002', 0, async function(done) {
+ try {
+ continuationManager.on("deviceDisconnect", function (data) {
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testOn002 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0300
+ * @tc.name [JS-API9]ContinuationManager.on().
+ * @tc.desc Test Js Api ContinuationManager.on() testcase 003
+ */
+ it('testOn003', 0, async function(done) {
+ try {
+ continuationManager.on("deviceConnect", token, function (data) {
+ expect(data == undefined).assertTrue();
+ })
+ done();
+ } catch (e) {
+ console.info("testOn003 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0400
+ * @tc.name [JS-API9]ContinuationManager.on().
+ * @tc.desc Test Js Api ContinuationManager.on() testcase 004
+ */
+ it('testOn004', 0, async function(done) {
+ try {
+ continuationManager.on("deviceDisconnect", token, function (data) {
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testOn004 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0100
+ * @tc.name [JS-API8]ContinuationManager.off().
+ * @tc.desc Test Js Api ContinuationManager.off() testcase 001
+ */
+ it('testOff001', 0, async function(done) {
+ try {
+ continuationManager.off("deviceConnect", function (data) {
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testOff001 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0200
+ * @tc.name [JS-API8]ContinuationManager.off().
+ * @tc.desc Test Js Api ContinuationManager.off() testcase 002
+ */
+ it('testOff002', 0, async function(done) {
+ try {
+ continuationManager.off("deviceDisconnect", function (data) {
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testOff002 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0300
+ * @tc.name [JS-API9]ContinuationManager.off().
+ * @tc.desc Test Js Api ContinuationManager.off() testcase 003
+ */
+ it('testOff003', 0, async function(done) {
+ try {
+ continuationManager.off("deviceConnect", token);
+ done();
+ } catch (e) {
+ console.info("testOff003 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0400
+ * @tc.name [JS-API9]ContinuationManager.off().
+ * @tc.desc Test Js Api ContinuationManager.off() testcase 004
+ */
+ it('testOff004', 0, async function(done) {
+ try {
+ continuationManager.off("deviceDisconnect", token);
+ done();
+ } catch (e) {
+ console.info("testOff004 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0100
+ * @tc.name [JS-API8]ContinuationManager.startDeviceManager().
+ * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 001
+ */
+ it('testStartDeviceManager001', 0, async function(done) {
+ try {
+ continuationManager.startDeviceManager(token, function (err, data) {
+ expect(err.code != 0).assertTrue();
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testStartDeviceManager001 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0100
+ * @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
+ * @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 001
+ */
+ it('testUpdateConnectStatus001', 0, async function(done) {
+ try {
+ continuationManager.updateConnectStatus(token, TEST_DEVICE_ID, TEST_CONNECT_STATUS, function (err, data) {
+ expect(err.code != 0).assertTrue();
+ expect(data == undefined).assertTrue();
+ });
+ done();
+ } catch (e) {
+ console.info("testUpdateConnectStatus001 " + e);
+ expect(null).assertFail();
+ done();
+ }
+ })
+})}
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/test/List.test.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/List.test.js
similarity index 78%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/test/List.test.js
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/List.test.js
index ad86f4e8ee7429eb485380bcbf30b36cd9704821..a6a82ae64195f994ca4755177bb6e6eb66b4ae48 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/test/List.test.js
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/List.test.js
@@ -1,15 +1,18 @@
-/*
-* Copyright (c) 2022 Huawei Device Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT 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('./ContinuationManagerJsunit.test.js')
\ No newline at end of file
+/*
+* Copyright (c) 2022 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import ContinuationManagerTest from './ContinuationManagerJsunit.test.js'
+export default function testsuite() {
+ContinuationManagerTest()
+}
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/element/string.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c931e164748318159c3a3939e588b26ec19f7b7f
--- /dev/null
+++ b/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ContinuationManagerJsTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
+ ]
+}
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/resources/base/media/icon.png b/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/media/icon.png
similarity index 100%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/resources/base/media/icon.png
rename to distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/media/icon.png
diff --git a/powermgr/power_manager/BUILD.gn b/powermgr/power_manager/BUILD.gn
old mode 100755
new mode 100644
index 81e9f258294d6040a0321a5aff95e169fe8a1b98..6696c40bded9937568beb91100a4183e66a80ec9
--- a/powermgr/power_manager/BUILD.gn
+++ b/powermgr/power_manager/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")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("powermgr_power_test") {
hap_name = "ActsPowerMgrPowerTest"
}
ohos_js_assets("powermgr_power_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("powermgr_power_resources") {
sources = [ "./src/main/resources" ]
diff --git a/powermgr/power_manager/Test.json b/powermgr/power_manager/Test.json
old mode 100755
new mode 100644
index 6ecc3d186d723e93f3b4938b770ec9223699f723..6f158418f69510a9fce2a987b17988301d282798
--- a/powermgr/power_manager/Test.json
+++ b/powermgr/power_manager/Test.json
@@ -1,24 +1,25 @@
-{
- "description": "Configuration for powermgr power Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "60000",
- "package": "com.example.mypowerapp",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "type": "ShellKit",
- "run-command": [
- "power-shell wakeup"
- ]
- },
- {
- "test-file-name": [
- "ActsPowerMgrPowerTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
+{
+ "description": "Configuration for powermgr power Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "60000",
+ "shell-timeout": "60000",
+ "bundle-name": "com.example.mypowerapp",
+ "package-name": "com.example.mypowerapp"
+ },
+ "kits": [
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "power-shell wakeup"
+ ]
+ },
+ {
+ "test-file-name": [
+ "ActsPowerMgrPowerTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
}
\ No newline at end of file
diff --git a/powermgr/power_manager/signature/openharmony_sx.p7b b/powermgr/power_manager/signature/openharmony_sx.p7b
old mode 100755
new mode 100644
diff --git a/powermgr/power_manager/src/main/config.json b/powermgr/power_manager/src/main/config.json
old mode 100755
new mode 100644
index 254c0142698673c1ef7dda4b2e5f08bf0fdc79bb..4e349dbc5ebfe42916428a7d6a9f46c84ba189ad
--- a/powermgr/power_manager/src/main/config.json
+++ b/powermgr/power_manager/src/main/config.json
@@ -1,60 +1,93 @@
{
- "app": {
- "bundleName": "com.example.mypowerapp",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.mypowerapp",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
+ "app": {
+ "bundleName": "com.example.mypowerapp",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
},
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.mypowerapp",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
],
- "name": "com.example.mypowerapp.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
+ "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"
+ }
],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
+ "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/powermgr/power_manager/src/main/js/default/app.js b/powermgr/power_manager/src/main/js/MainAbility/app.js
old mode 100755
new mode 100644
similarity index 100%
rename from powermgr/power_manager/src/main/js/default/app.js
rename to powermgr/power_manager/src/main/js/MainAbility/app.js
diff --git a/powermgr/power_manager/src/main/js/default/i18n/en-US.json b/powermgr/power_manager/src/main/js/MainAbility/i18n/en-US.json
old mode 100755
new mode 100644
similarity index 91%
rename from powermgr/power_manager/src/main/js/default/i18n/en-US.json
rename to powermgr/power_manager/src/main/js/MainAbility/i18n/en-US.json
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4
--- a/powermgr/power_manager/src/main/js/default/i18n/en-US.json
+++ b/powermgr/power_manager/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/powermgr/thermal_manager/src/main/js/default/i18n/zh-CN.json b/powermgr/power_manager/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 91%
rename from powermgr/thermal_manager/src/main/js/default/i18n/zh-CN.json
rename to powermgr/power_manager/src/main/js/MainAbility/i18n/zh-CN.json
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984 100644
--- a/powermgr/thermal_manager/src/main/js/default/i18n/zh-CN.json
+++ b/powermgr/power_manager/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/powermgr/power_manager/src/main/js/default/pages/index/index.css b/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.css
old mode 100755
new mode 100644
similarity index 96%
rename from powermgr/power_manager/src/main/js/default/pages/index/index.css
rename to powermgr/power_manager/src/main/js/MainAbility/pages/index/index.css
index 7311df55604b1bbcbd18d4d36e55655e8c3a99f1..239ac71e0e50015b3546e3a553e09533af6f8e6e
--- a/powermgr/power_manager/src/main/js/default/pages/index/index.css
+++ b/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.css
@@ -1,24 +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.
- */
-
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/powermgr/power_manager/src/main/js/default/pages/index/index.hml b/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.hml
old mode 100755
new mode 100644
similarity index 97%
rename from powermgr/power_manager/src/main/js/default/pages/index/index.hml
rename to powermgr/power_manager/src/main/js/MainAbility/pages/index/index.hml
index eeaf6a3fc3d3611dc94827c5e1a9f390513b6ed8..936e04ebdb33a919d0ce918652dac1da8bb6ec92
--- a/powermgr/power_manager/src/main/js/default/pages/index/index.hml
+++ b/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.hml
@@ -1,20 +1,20 @@
-
-
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.js b/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..a9eab98416e02857b749b448cc0d47d18cad90ae
--- /dev/null
+++ b/powermgr/power_manager/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import app from '@system.app'
+
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/powermgr/power_manager/src/main/js/TestAbility/app.js b/powermgr/power_manager/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/powermgr/power_manager/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/en-US.json b/powermgr/power_manager/src/main/js/TestAbility/i18n/en-US.json
similarity index 91%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/en-US.json
rename to powermgr/power_manager/src/main/js/TestAbility/i18n/en-US.json
index 55561b83737c3c31d082fbfa11e5fc987a351104..3cb24b374b1d919ca8eac0638f361692b603a900 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/i18n/en-US.json
+++ b/powermgr/power_manager/src/main/js/TestAbility/i18n/en-US.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/i18n/zh-CN.json b/powermgr/power_manager/src/main/js/TestAbility/i18n/zh-CN.json
similarity index 91%
rename from distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/i18n/zh-CN.json
rename to powermgr/power_manager/src/main/js/TestAbility/i18n/zh-CN.json
index cce1af06761a42add0cac1a0567aa3237eda8cb4..c804e32c0c3103929baca5617cdac70be11fdba1 100644
--- a/distributedschedule/dmsfwk/continuationmanagertest/entry/src/main/js/default/i18n/zh-CN.json
+++ b/powermgr/power_manager/src/main/js/TestAbility/i18n/zh-CN.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/powermgr/power_manager/src/main/js/TestAbility/pages/index/index.css b/powermgr/power_manager/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/powermgr/power_manager/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.hml b/powermgr/power_manager/src/main/js/TestAbility/pages/index/index.hml
similarity index 95%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.hml
rename to powermgr/power_manager/src/main/js/TestAbility/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..f629c71a9be857db6cdf94149652a191b9b272ea 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.hml
+++ b/powermgr/power_manager/src/main/js/TestAbility/pages/index/index.hml
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/powermgr/power_manager/src/main/js/TestAbility/pages/index/index.js b/powermgr/power_manager/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/powermgr/power_manager/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/powermgr/power_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/powermgr/power_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/powermgr/power_manager/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'] + '.TestAbility'
+
+ 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/powermgr/power_manager/src/main/js/default/pages/index/index.js b/powermgr/power_manager/src/main/js/default/pages/index/index.js
deleted file mode 100755
index 48e642298edd0e8a7c4d2abe07f02e14d5c0bae1..0000000000000000000000000000000000000000
--- a/powermgr/power_manager/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import app from '@system.app'
-
-import {Core, ExpectExtend} 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'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
-
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
\ No newline at end of file
diff --git a/powermgr/power_manager/src/main/js/default/test/List.test.js b/powermgr/power_manager/src/main/js/test/List.test.js
similarity index 71%
rename from powermgr/power_manager/src/main/js/default/test/List.test.js
rename to powermgr/power_manager/src/main/js/test/List.test.js
index 99e94ceb376fda755d197e5ecad73a2af40d7c6d..93bfba329b1c506e05dab60397de854ad2f36466 100644
--- a/powermgr/power_manager/src/main/js/default/test/List.test.js
+++ b/powermgr/power_manager/src/main/js/test/List.test.js
@@ -12,6 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./power_manager_running_lock.test.js')
-require('./power_manager_power.test.js')
-
+import appInfoTest_power_1 from './power_manager_power.test.js'
+import appInfoTest_power_2 from './power_manager_running_lock.test.js'
+export default function testsuite() {
+appInfoTest_power_1()
+appInfoTest_power_2()
+}
diff --git a/powermgr/power_manager/src/main/js/default/test/power_manager_power.test.js b/powermgr/power_manager/src/main/js/test/power_manager_power.test.js
similarity index 96%
rename from powermgr/power_manager/src/main/js/default/test/power_manager_power.test.js
rename to powermgr/power_manager/src/main/js/test/power_manager_power.test.js
index 9315bc81021ed99dbb77206600b3a95ffa6521b0..fc0377d59c07242251fffa91efc4f9bd73d2ccfc 100644
--- a/powermgr/power_manager/src/main/js/default/test/power_manager_power.test.js
+++ b/powermgr/power_manager/src/main/js/test/power_manager_power.test.js
@@ -1,217 +1,219 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import power from '@ohos.power';
-
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('appInfoTest_power_1', function () {
- console.log("*************Power Unit Test Begin*************");
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0010
- * @tc.name Power_Is_Screnn_On_Promise_JSTest0010
- * @tc.desc Checks whether the screen of a device is on or off
- */
- it('Power_Is_Screnn_On_Promise_JSTest0010', 0, async function (done) {
- power.wakeupDevice("Power_Is_Screnn_On_Promise_JSTest0010");
- power.isScreenOn()
- .then(screenOn => {
- console.info('Power_Is_Screnn_On_Promise_JSTest0010 screenOn is ' + screenOn);
- expect(screenOn).assertTrue();
- console.info('Power_Is_Screnn_On_Promise_JSTest0010 success');
- done();
- })
- .catch(error => {
- console.log('Power_Is_Screnn_On_Promise_JSTest0010 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0020
- * @tc.name Power_Is_Screnn_On_Callback_JSTest0020
- * @tc.desc Checks whether the screen of a device is on or off
- */
- it('Power_Is_Screnn_On_Callback_JSTest0020', 0, async function (done) {
- power.wakeupDevice("Power_Is_Screnn_On_Callback_JSTest0020");
- power.isScreenOn((error, screenOn) => {
- if (typeof error === "undefined") {
- console.info('Power_Is_Screnn_On_Callback_JSTest0020 screenOn is ' + screenOn);
- expect(screenOn).assertTrue();
- console.info('Power_Is_Screnn_On_Callback_JSTest0020 success');
- done();
- } else {
- console.log('Power_Is_Screnn_On_Callback_JSTest0020: ' + error);
- expect().assertFail();
- done();
- }
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0030
- * @tc.name Power_WakeupDevices_String_JSTest0030
- * @tc.desc Try to wakeup the device and let screen on
- */
- it('Power_WakeupDevices_String_JSTest0030', 0, async function (done) {
- power.isScreenOn()
- .then(screenOn => {
- console.info('Power_WakeupDevices_String_JSTest0030: The current screenOn is ' + screenOn);
- if (screenOn) {
- power.suspendDevice();
- }
- })
- .catch(error => {
- console.log('Power_WakeupDevices_String_JSTest0030 error: ' + error);
- expect().assertFail();
- done();
- })
- setTimeout(function(){
- power.wakeupDevice("Power_WakeupDevices_String_JSTest0030");
- power.isScreenOn()
- .then(screenOn => {
- console.info('Power_WakeupDevices_String_JSTest0030: The current screenOn is ' + screenOn);
- expect(screenOn).assertTrue();
- console.info('Power_WakeupDevices_String_JSTest0030 success');
- done();
- })
- .catch(error => {
- console.log('Power_WakeupDevices_String_JSTest0030 error: ' + error);
- expect().assertFail();
- done();
- })
- }, 2000);
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0040
- * @tc.name Power_SuspendDevices_JSTest0040
- * @tc.desc Try to suspend the device and let screen off
- */
- it('Power_SuspendDevices_JSTest0040', 0, async function (done) {
- power.isScreenOn()
- .then(screenOn => {
- console.info('Power_SuspendDevices_JSTest0040: The current screenOn is ' + screenOn);
- if (!screenOn) {
- power.wakeupDevice("Power_SuspendDevices_JSTest0040");
- }
- })
- .catch(error => {
- console.log('Power_SuspendDevices_JSTest0040 error: ' + error);
- expect().assertFail();
- done();
- })
- setTimeout(function(){
- power.suspendDevice();
- console.info('Power_SuspendDevices_JSTest0040: SuspendDevice end');
- power.isScreenOn()
- .then(screenOn => {
- console.info('Power_SuspendDevices_JSTest0040: The current screenOn is ' + screenOn);
- expect(screenOn).assertFalse();
- console.info('Power_SuspendDevices_JSTest0040 success');
- done();
- })
- .catch(error => {
- console.log('Power_SuspendDevices_JSTest0040 error: ' + error);
- expect().assertFail();
- done();
- })
- }, 2000);
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0050
- * @tc.name Power_Get_PowerMode_Callback_JSTest0050
- * @tc.desc Get The mode the device
- */
- it('Power_Get_PowerMode_Callback_JSTest0050', 0, async function (done) {
- power.getPowerMode()
- .then(powerMode => {
- console.info('Power_Get_PowerMode_Callback_JSTest0050 power mode is ' + powerMode);
- expect(powerMode >= 600 && powerMode <= 603).assertTrue();
- done();
- })
- .catch(error => {
- console.log('Power_Get_PowerMode_Callback_JSTest0050 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0060
- * @tc.name Power_Get_PowerMode_Promise_JSTest0060
- * @tc.desc Get The mode the device
- */
- it('Power_Get_PowerMode_Promise_JSTest0060', 0, async function (done) {
- power.getPowerMode((error, powerMode) => {
- if (typeof error === "undefined") {
- console.info('Power_Get_PowerMode_Promise_JSTest0060 power mode is ' + powerMode);
- expect(powerMode >= 600 && powerMode <= 603).assertTrue();
- done();
- } else {
- console.log('Power_Get_PowerMode_Promise_JSTest0060: ' + error);
- expect().assertFail();
- done();
- }
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0070
- * @tc.name Power_Device_Power_Mode_MODENORMAL_JSTest0070
- * @tc.desc Get device power mode MODE_NORMAL
- */
- it('Power_Device_Power_Mode_MODENORMAL_JSTest0070', 0, function () {
- let devicePowerMode = power.DevicePowerMode.MODE_NORMAL;
- console.info('MODE_NORMAL = ' + devicePowerMode);
- expect(devicePowerMode === 600).assertTrue();
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0080
- * @tc.name Power_Device_Power_Mode_MODEPOWERSAVE_JSTest0080
- * @tc.desc Get device power mode MODE_POWER_SAVE
- */
- it('Power_Device_Power_Mode_MODEPOWERSAVE_JSTest0080', 0, function () {
- let devicePowerMode = power.DevicePowerMode.MODE_POWER_SAVE;
- console.info('MODE_POWER_SAVE = ' + devicePowerMode);
- expect(devicePowerMode === 601).assertTrue();
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0090
- * @tc.name Power_Device_pPower_Mode_MODEPERFORMANCE_JSTest0090
- * @tc.desc Get device power mode MODE_PERFORMANCE
- */
- it('Power_Device_pPower_Mode_MODEPERFORMANCE_JSTest0090', 0, function () {
- let devicePowerMode = power.DevicePowerMode.MODE_PERFORMANCE;
- console.info('MODE_PERFORMANCE = ' + devicePowerMode);
- expect(devicePowerMode === 602).assertTrue();
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0100
- * @tc.name Power_Device_Power_Mode_MODE_EXTREME_POWER_SAVE_JSTest0100
- * @tc.desc Get device power mode MODE_EXTREME_POWER_SAVE
- */
- it('Power_Device_Power_Mode_MODE_EXTREME_POWER_SAVE_JSTest0100', 0, function () {
- let devicePowerMode = power.DevicePowerMode.MODE_EXTREME_POWER_SAVE;
- console.info('MODE_EXTREME_POWER_SAVE = ' + devicePowerMode);
- expect(devicePowerMode === 603).assertTrue();
- })
-})
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import power from '@ohos.power';
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export default function appInfoTest_power_1() {
+describe('appInfoTest_power_1', function () {
+ console.log("*************Power Unit Test Begin*************");
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0010
+ * @tc.name Power_Is_Screnn_On_Promise_JSTest0010
+ * @tc.desc Checks whether the screen of a device is on or off
+ */
+ it('Power_Is_Screnn_On_Promise_JSTest0010', 0, async function (done) {
+ power.wakeupDevice("Power_Is_Screnn_On_Promise_JSTest0010");
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('Power_Is_Screnn_On_Promise_JSTest0010 screenOn is ' + screenOn);
+ expect(screenOn).assertTrue();
+ console.info('Power_Is_Screnn_On_Promise_JSTest0010 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Power_Is_Screnn_On_Promise_JSTest0010 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0020
+ * @tc.name Power_Is_Screnn_On_Callback_JSTest0020
+ * @tc.desc Checks whether the screen of a device is on or off
+ */
+ it('Power_Is_Screnn_On_Callback_JSTest0020', 0, async function (done) {
+ power.wakeupDevice("Power_Is_Screnn_On_Callback_JSTest0020");
+ power.isScreenOn((error, screenOn) => {
+ if (typeof error === "undefined") {
+ console.info('Power_Is_Screnn_On_Callback_JSTest0020 screenOn is ' + screenOn);
+ expect(screenOn).assertTrue();
+ console.info('Power_Is_Screnn_On_Callback_JSTest0020 success');
+ done();
+ } else {
+ console.log('Power_Is_Screnn_On_Callback_JSTest0020: ' + error);
+ expect().assertFail();
+ done();
+ }
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0030
+ * @tc.name Power_WakeupDevices_String_JSTest0030
+ * @tc.desc Try to wakeup the device and let screen on
+ */
+ it('Power_WakeupDevices_String_JSTest0030', 0, async function (done) {
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('Power_WakeupDevices_String_JSTest0030: The current screenOn is ' + screenOn);
+ if (screenOn) {
+ power.suspendDevice();
+ }
+ })
+ .catch(error => {
+ console.log('Power_WakeupDevices_String_JSTest0030 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ setTimeout(function(){
+ power.wakeupDevice("Power_WakeupDevices_String_JSTest0030");
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('Power_WakeupDevices_String_JSTest0030: The current screenOn is ' + screenOn);
+ expect(screenOn).assertTrue();
+ console.info('Power_WakeupDevices_String_JSTest0030 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Power_WakeupDevices_String_JSTest0030 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ }, 2000);
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0040
+ * @tc.name Power_SuspendDevices_JSTest0040
+ * @tc.desc Try to suspend the device and let screen off
+ */
+ it('Power_SuspendDevices_JSTest0040', 0, async function (done) {
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('Power_SuspendDevices_JSTest0040: The current screenOn is ' + screenOn);
+ if (!screenOn) {
+ power.wakeupDevice("Power_SuspendDevices_JSTest0040");
+ }
+ })
+ .catch(error => {
+ console.log('Power_SuspendDevices_JSTest0040 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ setTimeout(function(){
+ power.suspendDevice();
+ console.info('Power_SuspendDevices_JSTest0040: SuspendDevice end');
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('Power_SuspendDevices_JSTest0040: The current screenOn is ' + screenOn);
+ expect(screenOn).assertFalse();
+ console.info('Power_SuspendDevices_JSTest0040 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Power_SuspendDevices_JSTest0040 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ }, 2000);
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0050
+ * @tc.name Power_Get_PowerMode_Callback_JSTest0050
+ * @tc.desc Get The mode the device
+ */
+ it('Power_Get_PowerMode_Callback_JSTest0050', 0, async function (done) {
+ power.getPowerMode()
+ .then(powerMode => {
+ console.info('Power_Get_PowerMode_Callback_JSTest0050 power mode is ' + powerMode);
+ expect(powerMode >= 600 && powerMode <= 603).assertTrue();
+ done();
+ })
+ .catch(error => {
+ console.log('Power_Get_PowerMode_Callback_JSTest0050 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0060
+ * @tc.name Power_Get_PowerMode_Promise_JSTest0060
+ * @tc.desc Get The mode the device
+ */
+ it('Power_Get_PowerMode_Promise_JSTest0060', 0, async function (done) {
+ power.getPowerMode((error, powerMode) => {
+ if (typeof error === "undefined") {
+ console.info('Power_Get_PowerMode_Promise_JSTest0060 power mode is ' + powerMode);
+ expect(powerMode >= 600 && powerMode <= 603).assertTrue();
+ done();
+ } else {
+ console.log('Power_Get_PowerMode_Promise_JSTest0060: ' + error);
+ expect().assertFail();
+ done();
+ }
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0070
+ * @tc.name Power_Device_Power_Mode_MODENORMAL_JSTest0070
+ * @tc.desc Get device power mode MODE_NORMAL
+ */
+ it('Power_Device_Power_Mode_MODENORMAL_JSTest0070', 0, function () {
+ let devicePowerMode = power.DevicePowerMode.MODE_NORMAL;
+ console.info('MODE_NORMAL = ' + devicePowerMode);
+ expect(devicePowerMode === 600).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0080
+ * @tc.name Power_Device_Power_Mode_MODEPOWERSAVE_JSTest0080
+ * @tc.desc Get device power mode MODE_POWER_SAVE
+ */
+ it('Power_Device_Power_Mode_MODEPOWERSAVE_JSTest0080', 0, function () {
+ let devicePowerMode = power.DevicePowerMode.MODE_POWER_SAVE;
+ console.info('MODE_POWER_SAVE = ' + devicePowerMode);
+ expect(devicePowerMode === 601).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0090
+ * @tc.name Power_Device_pPower_Mode_MODEPERFORMANCE_JSTest0090
+ * @tc.desc Get device power mode MODE_PERFORMANCE
+ */
+ it('Power_Device_pPower_Mode_MODEPERFORMANCE_JSTest0090', 0, function () {
+ let devicePowerMode = power.DevicePowerMode.MODE_PERFORMANCE;
+ console.info('MODE_PERFORMANCE = ' + devicePowerMode);
+ expect(devicePowerMode === 602).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0100
+ * @tc.name Power_Device_Power_Mode_MODE_EXTREME_POWER_SAVE_JSTest0100
+ * @tc.desc Get device power mode MODE_EXTREME_POWER_SAVE
+ */
+ it('Power_Device_Power_Mode_MODE_EXTREME_POWER_SAVE_JSTest0100', 0, function () {
+ let devicePowerMode = power.DevicePowerMode.MODE_EXTREME_POWER_SAVE;
+ console.info('MODE_EXTREME_POWER_SAVE = ' + devicePowerMode);
+ expect(devicePowerMode === 603).assertTrue();
+ })
+})
+}
diff --git a/powermgr/power_manager/src/main/js/default/test/power_manager_rebootshut.test.js b/powermgr/power_manager/src/main/js/test/power_manager_rebootshut.test.js
similarity index 95%
rename from powermgr/power_manager/src/main/js/default/test/power_manager_rebootshut.test.js
rename to powermgr/power_manager/src/main/js/test/power_manager_rebootshut.test.js
index bf685c793f07193522e121be50be68ded1f3e946..7be3b45ac81bde130763eab03ce29c8c58071ce5 100644
--- a/powermgr/power_manager/src/main/js/default/test/power_manager_rebootshut.test.js
+++ b/powermgr/power_manager/src/main/js/test/power_manager_rebootshut.test.js
@@ -1,117 +1,118 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import power from '@ohos.power';
-
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('appInfoTest', function () {
- console.log("*************Power Unit Test Begin*************");
-
- /**
- * @tc.number power_js_001
- * @tc.name power_creat_shutdownDevice_test
- * @tc.desc Device shutdown interface validation
- */
- it('creat_shutdownDevice_test01', 0, async function () {
- function shutPromise(){
- new Promise(function(resolve,reject){
- power.isScreenOn((error, screenOn)=>{
- if(screenOn){
- console.log('devices shutdown error');
- reject(screenOn);
- }else{
- console.log('devices shutdown success');
- resolve(error);
- }
- },1000)
- })
- }
- power.shutdownDevice("shutsown");
- shutPromise();
- })
-
- /**
- * @tc.number power_js_002
- * @tc.name power_creat_shutdownDevice_test
- * @tc.desc Device shutdown interface validation
- */
- it('creat_shutdownDevice_test02', 0, async function () {
- power.isScreenOn()
- .then(screenOn => {
- console.info('power_shutdownDevice_test: The current screenOn is ' + screenOn);
- if (!screenOn) {
- power.wakeupDevice("power_shutdownDevice_test");
- }
- })
- .catch(error => {
- console.log('power_shutdownDevice_test error: ' + error);
- expect().assertFail();
- done();
- })
- power.shutdownDevice("shutsown");
- console.info('power_shutdownDevice_test: shutdownDevice end');
- setTimeout(function(){
- power.isScreenOn()
- .then(screenOn => {
- console.info('power_shutdownDevice_test: The current screenOn is ' + screenOn);
- expect(screenOn).assertFalse();
- console.info('power_shutdownDevice_test success');
- done();
- })
- .catch(error => {
- console.log('power_shutdownDevice_test error: ' + error);
- expect().assertFail();
- done();
- })
- }, 2000);
- })
-
- /**
- * @tc.number power_js_003
- * @tc.name power_creat_rebootDeviceDevice_test
- * @tc.desc Device reboot interface verification
- */
- it('creat_rebootDeviceDevice_test', 0, async function () {
- power.isScreenOn()
- .then(screenOn => {
- console.info('power_rebootDevice_test: The current screenOn is ' + screenOn);
- if (!screenOn) {
- power.wakeupDevice("power_rebootDevice_test");
- }
- })
- .catch(error => {
- console.log('power_rebootDevice_test error: ' + error);
- expect().assertFail();
- done();
- })
- power.rebootDevice("shutsown");
- console.info('power_rebootDevice_test: rebootDevice end');
- setTimeout(function(){
- power.isScreenOn()
- .then(screenOn => {
- console.info('power_rebootDevice_test: The current screenOn is ' + screenOn);
- expect(screenOn).assertFalse();
- console.info('power_rebootDevice_test success');
- done();
- })
- .catch(error => {
- console.log('power_rebootDevice_test error: ' + error);
- expect().assertFail();
- done();
- })
- }, 2000);
- })
-})
\ 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 power from '@ohos.power';
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export default function appInfoTest() {
+describe('appInfoTest', function () {
+ console.log("*************Power Unit Test Begin*************");
+
+ /**
+ * @tc.number power_js_001
+ * @tc.name power_creat_shutdownDevice_test
+ * @tc.desc Device shutdown interface validation
+ */
+ it('creat_shutdownDevice_test01', 0, async function () {
+ function shutPromise(){
+ new Promise(function(resolve,reject){
+ power.isScreenOn((error, screenOn)=>{
+ if(screenOn){
+ console.log('devices shutdown error');
+ reject(screenOn);
+ }else{
+ console.log('devices shutdown success');
+ resolve(error);
+ }
+ },1000)
+ })
+ }
+ power.shutdownDevice("shutsown");
+ shutPromise();
+ })
+
+ /**
+ * @tc.number power_js_002
+ * @tc.name power_creat_shutdownDevice_test
+ * @tc.desc Device shutdown interface validation
+ */
+ it('creat_shutdownDevice_test02', 0, async function () {
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('power_shutdownDevice_test: The current screenOn is ' + screenOn);
+ if (!screenOn) {
+ power.wakeupDevice("power_shutdownDevice_test");
+ }
+ })
+ .catch(error => {
+ console.log('power_shutdownDevice_test error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ power.shutdownDevice("shutsown");
+ console.info('power_shutdownDevice_test: shutdownDevice end');
+ setTimeout(function(){
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('power_shutdownDevice_test: The current screenOn is ' + screenOn);
+ expect(screenOn).assertFalse();
+ console.info('power_shutdownDevice_test success');
+ done();
+ })
+ .catch(error => {
+ console.log('power_shutdownDevice_test error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ }, 2000);
+ })
+
+ /**
+ * @tc.number power_js_003
+ * @tc.name power_creat_rebootDeviceDevice_test
+ * @tc.desc Device reboot interface verification
+ */
+ it('creat_rebootDeviceDevice_test', 0, async function () {
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('power_rebootDevice_test: The current screenOn is ' + screenOn);
+ if (!screenOn) {
+ power.wakeupDevice("power_rebootDevice_test");
+ }
+ })
+ .catch(error => {
+ console.log('power_rebootDevice_test error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ power.rebootDevice("shutsown");
+ console.info('power_rebootDevice_test: rebootDevice end');
+ setTimeout(function(){
+ power.isScreenOn()
+ .then(screenOn => {
+ console.info('power_rebootDevice_test: The current screenOn is ' + screenOn);
+ expect(screenOn).assertFalse();
+ console.info('power_rebootDevice_test success');
+ done();
+ })
+ .catch(error => {
+ console.log('power_rebootDevice_test error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ }, 2000);
+ })
+})}
diff --git a/powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js b/powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js
similarity index 97%
rename from powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js
rename to powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js
index ce1707b36e442ae95f4442c38ad6d9cdd99904a9..0d61e34b709a1b1d1e2664062043de1b830e25b5 100644
--- a/powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js
+++ b/powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js
@@ -1,231 +1,233 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import runningLock from '@ohos.runninglock'
-
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('appInfoTest_power_2', function () {
- console.log("*************RunningLock Unit Test Begin*************");
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0110
- * @tc.name Create_Running_Lock_Promise_JSTest0010
- * @tc.desc Create running lock
- */
- it('Create_Running_Lock_Promise_JSTest0010', 0, async function (done) {
- runningLock.createRunningLock("running_lock_test_1", runningLock.RunningLockType.BACKGROUND)
- .then(runninglock => {
- expect(runninglock !== null).assertTrue();
- console.info('Create_Running_Lock_Promise_JSTest0010 success');
- done();
- })
- .catch(error => {
- console.log('Create_Running_Lock_Promise_JSTest0010 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0120
- * @tc.name Create_Running_Lock_CallBack_JSTest0020
- * @tc.desc Create running lock
- */
- it('Create_Running_Lock_CallBack_JSTest0020', 0, async function (done) {
- runningLock.createRunningLock("running_lock_test_2", runningLock.RunningLockType.BACKGROUND,
- (error, runninglock) => {
- if (typeof error === "undefined") {
- console.info('Create_Running_Lock_CallBack_JSTest0020: runningLock is ' + runninglock);
- expect(runninglock !== null).assertTrue();
- let used = runninglock.isUsed();
- console.info('Create_Running_Lock_CallBack_JSTest0020 is used: ' + used);
- expect(used).assertFalse();
- runninglock.lock(500);
- used = runninglock.isUsed();
- console.info('after lock Create_Running_Lock_CallBack_JSTest0020 is used: ' + used);
- expect(used).assertTrue();
- console.info('Create_Running_Lock_CallBack_JSTest0020 success');
- done();
- } else {
- console.log('Create_Running_Lock_CallBack_JSTest0020: ' + error);
- expect().assertFail();
- done();
- }
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0130
- * @tc.name Running_Lock_Lock_JSTest0030
- * @tc.desc Prevents the system from hibernating and sets the lock duration
- */
- it('Running_Lock_Lock_JSTest0030', 0, async function (done) {
- runningLock.createRunningLock("running_lock_test_3", runningLock.RunningLockType.BACKGROUND)
- .then(runninglock => {
- expect(runninglock !== null).assertTrue();
- let used = runninglock.isUsed();
- console.info('Running_Lock_Lock_JSTest0030 is used: ' + used);
- expect(used).assertFalse();
- runninglock.lock(500);
- used = runninglock.isUsed();
- console.info('after lock Running_Lock_Lock_JSTest0030 is used: ' + used);
- expect(used).assertTrue();
- console.info('Running_Lock_Lock_JSTest0030 success');
- done();
- })
- .catch(error => {
- console.log('Running_Lock_Lock_JSTest0030 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0140
- * @tc.name Running_Lock_used_JSTest0040
- * @tc.desc Checks whether a lock is held or in use
- */
- it('Running_Lock_used_JSTest0040', 0, async function (done) {
- runningLock.createRunningLock("running_lock_test_4", runningLock.RunningLockType.BACKGROUND)
- .then(runninglock => {
- expect(runninglock !== null).assertTrue();
- let used = runninglock.isUsed();
- console.info('Running_Lock_used_JSTest0040 used: ' + used);
- expect(used).assertFalse();
- console.info('Running_Lock_used_JSTest0040 success');
- done();
- })
- .catch(error => {
- console.log('Running_Lock_used_JSTest0040 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0150
- * @tc.name Running_Lock_Unlock_JSTest0050
- * @tc.desc Release running lock
- */
- it('Running_Lock_Unlock_JSTest0050', 0, async function (done) {
- runningLock.createRunningLock("running_lock_test_5", runningLock.RunningLockType.BACKGROUND)
- .then(runninglock => {
- expect(runninglock !== null).assertTrue();
- let used = runninglock.isUsed();
- console.info('Running_Lock_Unlock_JSTest0050 is used: ' + used);
- expect(used).assertFalse();
- runninglock.lock(500);
- used = runninglock.isUsed();
- console.info('after lock Running_Lock_Unlock_JSTest0050 is used: ' + used);
- expect(used).assertTrue();
- runninglock.unlock();
- used = runninglock.isUsed();
- console.info('after unlock Running_Lock_Unlock_JSTest0050 is used: ' + used);
- expect(used).assertFalse();
- console.info('Running_Lock_Unlock_JSTest0050 success');
- done();
- })
- .catch(error => {
- console.log('Running_Lock_Unlock_JSTest0050 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0160
- * @tc.name Enum_RunningLock_Type_Background_JSTest0060
- * @tc.desc The lock type is BACKGROUND
- */
- it('Enum_RunningLock_Type_Background_JSTest0060', 0, function () {
- let runningLockType = runningLock.RunningLockType.BACKGROUND;
- console.info('runningLockType = ' + runningLockType);
- expect(runningLockType == 1).assertTrue();
- console.info('Enum_RunningLock_Type_Background_JSTest0060 success');
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0170
- * @tc.name Enum_RunningLock_Type_Proximityscreencontrol_JSTest0070
- * @tc.desc The lock type is PROXIMITY_SCREEN_CONTROL
- */
- it('Enum_RunningLock_Type_Proximityscreencontrol_JSTest0070', 0, function () {
- let runningLockType = runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL;
- console.info('runningLockType = ' + runningLockType);
- expect(runningLockType == 2).assertTrue();
- console.info('Enum_RunningLock_Type_Proximityscreencontrol_JSTest0070 success');
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0180
- * @tc.name Is_Runninglock_Type_Supported_Promise_Test1_JSTest0080
- * @tc.desc Checks whether the specified RunningLockType is supported.
- */
- it('Is_Runninglock_Type_Supported_Promise_Test1_JSTest0080', 0, async function (done) {
- runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL)
- .then(supported => {
- console.info('is_runninglock_type_supported_test_1 PROXIMITY_SCREEN_CONTROL supported is ' + supported);
- expect(supported).assertTrue();
- console.info('is_runninglock_type_supported_test_1 success');
- done();
- })
- .catch(error => {
- console.log('is_runninglock_type_supported_test_1 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0190
- * @tc.name Is_Runninglock_Type_Supported_Promise_Test2_JSTest0090
- * @tc.desc Checks whether the specified RunningLockType is supported.
- */
- it('Is_Runninglock_Type_Supported_Promise_Test2_JSTest0090', 0, async function (done) {
- runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND)
- .then(supported => {
- console.info('Is_Runninglock_Type_Supported_Promise_Test2 BACKGROUND supported is ' + supported);
- expect(supported).assertTrue();
- console.info('Is_Runninglock_Type_Supported_Promise_Test2 success');
- done();
- })
- .catch(error => {
- console.log('Is_Runninglock_Type_Supported_Promise_Test2 error: ' + error);
- expect().assertFail();
- done();
- })
- })
-
- /**
- * @tc.number SUB_PowerSystem_PowerManager_JSTest_0200
- * @tc.name Is_Runninglock_Type_Supported_Callback_test3_JSTest0100
- * @tc.desc Checks whether the specified RunningLockType is supported.
- */
- it('Is_Runninglock_Type_Supported_Callback_test3_JSTest0100', 0, async function (done) {
- runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND, (error, supported) => {
- if (typeof error === "undefined") {
- console.info('Is_Runninglock_Type_Supported_Callback_test3_JSTest supported is ' + supported);
- expect(supported).assertTrue();
- console.info('Is_Runninglock_Type_Supported_Callback_test3_JSTest success');
- done();
- } else {
- console.log('Is_Runninglock_Type_Supported_Callback_test3_JSTest: ' + error);
- expect().assertFail();
- 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 runningLock from '@ohos.runninglock'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export default function appInfoTest_power_2() {
+describe('appInfoTest_power_2', function () {
+ console.log("*************RunningLock Unit Test Begin*************");
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0110
+ * @tc.name Create_Running_Lock_Promise_JSTest0010
+ * @tc.desc Create running lock
+ */
+ it('Create_Running_Lock_Promise_JSTest0010', 0, async function (done) {
+ runningLock.createRunningLock("running_lock_test_1", runningLock.RunningLockType.BACKGROUND)
+ .then(runninglock => {
+ expect(runninglock !== null).assertTrue();
+ console.info('Create_Running_Lock_Promise_JSTest0010 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Create_Running_Lock_Promise_JSTest0010 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0120
+ * @tc.name Create_Running_Lock_CallBack_JSTest0020
+ * @tc.desc Create running lock
+ */
+ it('Create_Running_Lock_CallBack_JSTest0020', 0, async function (done) {
+ runningLock.createRunningLock("running_lock_test_2", runningLock.RunningLockType.BACKGROUND,
+ (error, runninglock) => {
+ if (typeof error === "undefined") {
+ console.info('Create_Running_Lock_CallBack_JSTest0020: runningLock is ' + runninglock);
+ expect(runninglock !== null).assertTrue();
+ let used = runninglock.isUsed();
+ console.info('Create_Running_Lock_CallBack_JSTest0020 is used: ' + used);
+ expect(used).assertFalse();
+ runninglock.lock(500);
+ used = runninglock.isUsed();
+ console.info('after lock Create_Running_Lock_CallBack_JSTest0020 is used: ' + used);
+ expect(used).assertTrue();
+ console.info('Create_Running_Lock_CallBack_JSTest0020 success');
+ done();
+ } else {
+ console.log('Create_Running_Lock_CallBack_JSTest0020: ' + error);
+ expect().assertFail();
+ done();
+ }
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0130
+ * @tc.name Running_Lock_Lock_JSTest0030
+ * @tc.desc Prevents the system from hibernating and sets the lock duration
+ */
+ it('Running_Lock_Lock_JSTest0030', 0, async function (done) {
+ runningLock.createRunningLock("running_lock_test_3", runningLock.RunningLockType.BACKGROUND)
+ .then(runninglock => {
+ expect(runninglock !== null).assertTrue();
+ let used = runninglock.isUsed();
+ console.info('Running_Lock_Lock_JSTest0030 is used: ' + used);
+ expect(used).assertFalse();
+ runninglock.lock(500);
+ used = runninglock.isUsed();
+ console.info('after lock Running_Lock_Lock_JSTest0030 is used: ' + used);
+ expect(used).assertTrue();
+ console.info('Running_Lock_Lock_JSTest0030 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Running_Lock_Lock_JSTest0030 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0140
+ * @tc.name Running_Lock_used_JSTest0040
+ * @tc.desc Checks whether a lock is held or in use
+ */
+ it('Running_Lock_used_JSTest0040', 0, async function (done) {
+ runningLock.createRunningLock("running_lock_test_4", runningLock.RunningLockType.BACKGROUND)
+ .then(runninglock => {
+ expect(runninglock !== null).assertTrue();
+ let used = runninglock.isUsed();
+ console.info('Running_Lock_used_JSTest0040 used: ' + used);
+ expect(used).assertFalse();
+ console.info('Running_Lock_used_JSTest0040 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Running_Lock_used_JSTest0040 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0150
+ * @tc.name Running_Lock_Unlock_JSTest0050
+ * @tc.desc Release running lock
+ */
+ it('Running_Lock_Unlock_JSTest0050', 0, async function (done) {
+ runningLock.createRunningLock("running_lock_test_5", runningLock.RunningLockType.BACKGROUND)
+ .then(runninglock => {
+ expect(runninglock !== null).assertTrue();
+ let used = runninglock.isUsed();
+ console.info('Running_Lock_Unlock_JSTest0050 is used: ' + used);
+ expect(used).assertFalse();
+ runninglock.lock(500);
+ used = runninglock.isUsed();
+ console.info('after lock Running_Lock_Unlock_JSTest0050 is used: ' + used);
+ expect(used).assertTrue();
+ runninglock.unlock();
+ used = runninglock.isUsed();
+ console.info('after unlock Running_Lock_Unlock_JSTest0050 is used: ' + used);
+ expect(used).assertFalse();
+ console.info('Running_Lock_Unlock_JSTest0050 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Running_Lock_Unlock_JSTest0050 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0160
+ * @tc.name Enum_RunningLock_Type_Background_JSTest0060
+ * @tc.desc The lock type is BACKGROUND
+ */
+ it('Enum_RunningLock_Type_Background_JSTest0060', 0, function () {
+ let runningLockType = runningLock.RunningLockType.BACKGROUND;
+ console.info('runningLockType = ' + runningLockType);
+ expect(runningLockType == 1).assertTrue();
+ console.info('Enum_RunningLock_Type_Background_JSTest0060 success');
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0170
+ * @tc.name Enum_RunningLock_Type_Proximityscreencontrol_JSTest0070
+ * @tc.desc The lock type is PROXIMITY_SCREEN_CONTROL
+ */
+ it('Enum_RunningLock_Type_Proximityscreencontrol_JSTest0070', 0, function () {
+ let runningLockType = runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL;
+ console.info('runningLockType = ' + runningLockType);
+ expect(runningLockType == 2).assertTrue();
+ console.info('Enum_RunningLock_Type_Proximityscreencontrol_JSTest0070 success');
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0180
+ * @tc.name Is_Runninglock_Type_Supported_Promise_Test1_JSTest0080
+ * @tc.desc Checks whether the specified RunningLockType is supported.
+ */
+ it('Is_Runninglock_Type_Supported_Promise_Test1_JSTest0080', 0, async function (done) {
+ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL)
+ .then(supported => {
+ console.info('is_runninglock_type_supported_test_1 PROXIMITY_SCREEN_CONTROL supported is ' + supported);
+ expect(supported).assertTrue();
+ console.info('is_runninglock_type_supported_test_1 success');
+ done();
+ })
+ .catch(error => {
+ console.log('is_runninglock_type_supported_test_1 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0190
+ * @tc.name Is_Runninglock_Type_Supported_Promise_Test2_JSTest0090
+ * @tc.desc Checks whether the specified RunningLockType is supported.
+ */
+ it('Is_Runninglock_Type_Supported_Promise_Test2_JSTest0090', 0, async function (done) {
+ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND)
+ .then(supported => {
+ console.info('Is_Runninglock_Type_Supported_Promise_Test2 BACKGROUND supported is ' + supported);
+ expect(supported).assertTrue();
+ console.info('Is_Runninglock_Type_Supported_Promise_Test2 success');
+ done();
+ })
+ .catch(error => {
+ console.log('Is_Runninglock_Type_Supported_Promise_Test2 error: ' + error);
+ expect().assertFail();
+ done();
+ })
+ })
+
+ /**
+ * @tc.number SUB_PowerSystem_PowerManager_JSTest_0200
+ * @tc.name Is_Runninglock_Type_Supported_Callback_test3_JSTest0100
+ * @tc.desc Checks whether the specified RunningLockType is supported.
+ */
+ it('Is_Runninglock_Type_Supported_Callback_test3_JSTest0100', 0, async function (done) {
+ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND, (error, supported) => {
+ if (typeof error === "undefined") {
+ console.info('Is_Runninglock_Type_Supported_Callback_test3_JSTest supported is ' + supported);
+ expect(supported).assertTrue();
+ console.info('Is_Runninglock_Type_Supported_Callback_test3_JSTest success');
+ done();
+ } else {
+ console.log('Is_Runninglock_Type_Supported_Callback_test3_JSTest: ' + error);
+ expect().assertFail();
+ done();
+ }
+ })
+ })
+})
+}
diff --git a/powermgr/power_manager/src/main/js/default/test/power_performance_test.js b/powermgr/power_manager/src/main/js/test/power_performance_test.js
similarity index 95%
rename from powermgr/power_manager/src/main/js/default/test/power_performance_test.js
rename to powermgr/power_manager/src/main/js/test/power_performance_test.js
index 56f6492f38079a524cb5199f1cd0cb7eedf39371..cd854962e7c08c6c842f3bdadea686a64edf39f5 100644
--- a/powermgr/power_manager/src/main/js/default/test/power_performance_test.js
+++ b/powermgr/power_manager/src/main/js/test/power_performance_test.js
@@ -1,152 +1,154 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import runningLock from '@ohos.runninglock';
-import power from '@ohos.power';
-import brightness from '@ohos.brightness';
-import { describe, it, expect } from 'deccjsunit/index';
-
-describe('appInfoTest_power_3', function () {
-
- console.log("*************Power Performance Test Begin*************");
- const MAXNUM = 1000;
- const MIDNUM = 100;
- const MS_TO_US = 1000;
- const LIMIT_TIME = 1500;
- const LIMIT_TIME_LONG = 4000;
-
- /**
- * @tc.number PowerPerformance_001
- * @tc.name createRunningLock_test
- * @tc.desc Interface is called normally
- */
- it('PowerPerformance_001', 0, async function (done) {
- let startTime = new Date().getTime();
- for (let i = 0; i < MIDNUM; i++) {
- await runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND)
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime / MIDNUM * MS_TO_US; //us
- console.info(`POWER_Performance_001: Promise: runningLock.createRunningLock Wait Time : ${waitTime}`);
- avgTime < LIMIT_TIME_LONG ? expect(true).assertTrue() : expect(false).assertTrue();
- done();
- })
-
- /**
- * @tc.number PowerPerformance_003
- * @tc.name lock_test
- * @tc.desc Interface is called normally
- */
- it('PowerPerformance_003', 0, async function (done) {
- let avgTime = 0;
- runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND, (error, runningLock) => {
- if (typeof error === "undefined") {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- runningLock.lock(500);
- }
- let waitTime = new Date().getTime() - startTime;
- avgTime = avgTime + waitTime; //us
- console.info(`PowerPerformance_003: Promise: runningLock.lock Wait Time : ${waitTime}`);
- avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
- runningLock.unlock();
- done();
- } else {
- console.log('PowerPerformance_003: ' + error);
- console.info('PowerPerformance_003: lock is ' + runningLock);
- done();
- }
- })
- })
-
- /**
- * @tc.number PowerPerformance_004
- * @tc.name unlock_test
- * @tc.desc Interface is called normally
- */
- it('PowerPerformance_004', 0, async function (done) {
- let avgTime = 0;
- runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND, (error, runningLock) => {
- if (typeof error === "undefined") {
- runningLock.lock(500);
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- runningLock.unlock();
- }
- let waitTime = new Date().getTime() - startTime;
- avgTime = avgTime + waitTime; //us
- console.info(`PowerPerformance_004: Promise: runningLock.unlock Wait Time : ${waitTime}`);
- avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
- done();
- } else {
- console.log('PowerPerformance_004: ' + error);
- console.info('PowerPerformance_004: lock is ' + runningLock);
- done();
- }
- })
- })
-
- /**
- * @tc.number PowerPerformance_005
- * @tc.name isProximitySupported_test
- * @tc.desc Interface is called normally
- */
- it('PowerPerformance_005', 0, async function (done) {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- await runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL)
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime / MAXNUM * MS_TO_US; //us
- console.info(`PowerPerformance_005: Promise: await runningLock.isRunningLockTypeSupported Wait Time :
- ${waitTime}`);
- avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
- done();
- })
-
- /**
- * @tc.number PowerPerformance_006
- * @tc.name isScreenOn_test
- * @tc.desc AsyncCallback judge whether the screen is lit and return to true
- */
- it('PowerPerformance_006', 0, async function (done) {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- await power.isScreenOn()
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime / MAXNUM * MS_TO_US; //us
- console.info(`PowerPerformance_006: Promise: await power.isScreenOn Wait Time : ${waitTime}`);
- avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
- done();
- })
-
- /**
- * @tc.number PowerPerformance_007
- * @tc.name setValue_test
- * @tc.desc Interface is called normally
- */
- it('PowerPerformance_007', 0, function () {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- brightness.setValue(100);
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime / MAXNUM * MS_TO_US; //us
- console.info(`PowerPerformance_007: Promise: brightness.setValue Wait Time : ${waitTime}`);
- avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
- })
-
-})
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import runningLock from '@ohos.runninglock';
+import power from '@ohos.power';
+import brightness from '@ohos.brightness';
+import { describe, it, expect } from '@ohos/hypium';
+
+export default function appInfoTest_power_3() {
+describe('appInfoTest_power_3', function () {
+
+ console.log("*************Power Performance Test Begin*************");
+ const MAXNUM = 1000;
+ const MIDNUM = 100;
+ const MS_TO_US = 1000;
+ const LIMIT_TIME = 1500;
+ const LIMIT_TIME_LONG = 4000;
+
+ /**
+ * @tc.number PowerPerformance_001
+ * @tc.name createRunningLock_test
+ * @tc.desc Interface is called normally
+ */
+ it('PowerPerformance_001', 0, async function (done) {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MIDNUM; i++) {
+ await runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND)
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime / MIDNUM * MS_TO_US; //us
+ console.info(`POWER_Performance_001: Promise: runningLock.createRunningLock Wait Time : ${waitTime}`);
+ avgTime < LIMIT_TIME_LONG ? expect(true).assertTrue() : expect(false).assertTrue();
+ done();
+ })
+
+ /**
+ * @tc.number PowerPerformance_003
+ * @tc.name lock_test
+ * @tc.desc Interface is called normally
+ */
+ it('PowerPerformance_003', 0, async function (done) {
+ let avgTime = 0;
+ runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND, (error, runningLock) => {
+ if (typeof error === "undefined") {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ runningLock.lock(500);
+ }
+ let waitTime = new Date().getTime() - startTime;
+ avgTime = avgTime + waitTime; //us
+ console.info(`PowerPerformance_003: Promise: runningLock.lock Wait Time : ${waitTime}`);
+ avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
+ runningLock.unlock();
+ done();
+ } else {
+ console.log('PowerPerformance_003: ' + error);
+ console.info('PowerPerformance_003: lock is ' + runningLock);
+ done();
+ }
+ })
+ })
+
+ /**
+ * @tc.number PowerPerformance_004
+ * @tc.name unlock_test
+ * @tc.desc Interface is called normally
+ */
+ it('PowerPerformance_004', 0, async function (done) {
+ let avgTime = 0;
+ runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND, (error, runningLock) => {
+ if (typeof error === "undefined") {
+ runningLock.lock(500);
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ runningLock.unlock();
+ }
+ let waitTime = new Date().getTime() - startTime;
+ avgTime = avgTime + waitTime; //us
+ console.info(`PowerPerformance_004: Promise: runningLock.unlock Wait Time : ${waitTime}`);
+ avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
+ done();
+ } else {
+ console.log('PowerPerformance_004: ' + error);
+ console.info('PowerPerformance_004: lock is ' + runningLock);
+ done();
+ }
+ })
+ })
+
+ /**
+ * @tc.number PowerPerformance_005
+ * @tc.name isProximitySupported_test
+ * @tc.desc Interface is called normally
+ */
+ it('PowerPerformance_005', 0, async function (done) {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ await runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL)
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime / MAXNUM * MS_TO_US; //us
+ console.info(`PowerPerformance_005: Promise: await runningLock.isRunningLockTypeSupported Wait Time :
+ ${waitTime}`);
+ avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
+ done();
+ })
+
+ /**
+ * @tc.number PowerPerformance_006
+ * @tc.name isScreenOn_test
+ * @tc.desc AsyncCallback judge whether the screen is lit and return to true
+ */
+ it('PowerPerformance_006', 0, async function (done) {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ await power.isScreenOn()
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime / MAXNUM * MS_TO_US; //us
+ console.info(`PowerPerformance_006: Promise: await power.isScreenOn Wait Time : ${waitTime}`);
+ avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
+ done();
+ })
+
+ /**
+ * @tc.number PowerPerformance_007
+ * @tc.name setValue_test
+ * @tc.desc Interface is called normally
+ */
+ it('PowerPerformance_007', 0, function () {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ brightness.setValue(100);
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime / MAXNUM * MS_TO_US; //us
+ console.info(`PowerPerformance_007: Promise: brightness.setValue Wait Time : ${waitTime}`);
+ avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
+ })
+
+})
+}
diff --git a/powermgr/power_manager/src/main/resources/base/element/string.json b/powermgr/power_manager/src/main/resources/base/element/string.json
old mode 100755
new mode 100644
index e1322c1183b4182a00c2567e584c8770bf316bf0..97df9fd9b18111ead62d4b596aba2fe779f8ad25
--- a/powermgr/power_manager/src/main/resources/base/element/string.json
+++ b/powermgr/power_manager/src/main/resources/base/element/string.json
@@ -7,6 +7,22 @@
{
"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/powermgr/power_manager/src/main/resources/base/media/icon.png b/powermgr/power_manager/src/main/resources/base/media/icon.png
old mode 100755
new mode 100644
diff --git a/powermgr/thermal_manager/BUILD.gn b/powermgr/thermal_manager/BUILD.gn
index 65797fa6caaceff5b4702241ef1fa01140c5ca9d..cd5a84849ac67f8b51813e5000944e48ec3253a8 100644
--- a/powermgr/thermal_manager/BUILD.gn
+++ b/powermgr/thermal_manager/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")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("powermgr_thermal_test") {
hap_name = "ActsPowerMgrThermalTest"
}
ohos_js_assets("powermgr_thermal_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("powermgr_thermal_resources") {
sources = [ "./src/main/resources" ]
diff --git a/powermgr/thermal_manager/Test.json b/powermgr/thermal_manager/Test.json
index 620b0e92485dcf593b672ac07304fbd7d59ec028..312d67822f45d707704191c25356df4bc19590d0 100644
--- a/powermgr/thermal_manager/Test.json
+++ b/powermgr/thermal_manager/Test.json
@@ -1,19 +1,19 @@
-{
- "description": "Configuration for powermgr thermal Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "120000",
- "package": "com.example.mythermalapp",
- "shell-timeout": "120000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsPowerMgrThermalTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
-
+{
+ "description": "Configuration for powermgr thermal Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "120000",
+ "shell-timeout": "120000",
+ "bundle-name": "com.example.mythermalapp",
+ "package-name": "com.example.mythermalapp"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsPowerMgrThermalTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/powermgr/thermal_manager/src/main/config.json b/powermgr/thermal_manager/src/main/config.json
index 74321b19bb68aa5c1b740efa823e6653aac269b3..118479d8c847f09f4e232af18a3bc49b23ef7396 100644
--- a/powermgr/thermal_manager/src/main/config.json
+++ b/powermgr/thermal_manager/src/main/config.json
@@ -1,60 +1,93 @@
{
- "app": {
- "bundleName": "com.example.mythermalapp",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.mythermalapp",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
+ "app": {
+ "bundleName": "com.example.mythermalapp",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
},
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.mythermalapp",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
],
- "name": "com.example.mythermalapp.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
+ "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"
+ }
],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
-}
+ "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/powermgr/thermal_manager/src/main/js/default/app.js b/powermgr/thermal_manager/src/main/js/MainAbility/app.js
similarity index 100%
rename from powermgr/thermal_manager/src/main/js/default/app.js
rename to powermgr/thermal_manager/src/main/js/MainAbility/app.js
diff --git a/powermgr/thermal_manager/src/main/js/default/i18n/en-US.json b/powermgr/thermal_manager/src/main/js/MainAbility/i18n/en-US.json
similarity index 91%
rename from powermgr/thermal_manager/src/main/js/default/i18n/en-US.json
rename to powermgr/thermal_manager/src/main/js/MainAbility/i18n/en-US.json
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 100644
--- a/powermgr/thermal_manager/src/main/js/default/i18n/en-US.json
+++ b/powermgr/thermal_manager/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/powermgr/power_manager/src/main/js/default/i18n/zh-CN.json b/powermgr/thermal_manager/src/main/js/MainAbility/i18n/zh-CN.json
old mode 100755
new mode 100644
similarity index 91%
rename from powermgr/power_manager/src/main/js/default/i18n/zh-CN.json
rename to powermgr/thermal_manager/src/main/js/MainAbility/i18n/zh-CN.json
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984
--- a/powermgr/power_manager/src/main/js/default/i18n/zh-CN.json
+++ b/powermgr/thermal_manager/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/powermgr/thermal_manager/src/main/js/default/pages/index/index.css b/powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.css
similarity index 96%
rename from powermgr/thermal_manager/src/main/js/default/pages/index/index.css
rename to powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.css
index 7300d2a1fa143c4d24a9bcba4e5f76363ee7b3a4..cff50023ce54b7fbbbae9ecd72ab5a49e0b50291 100644
--- a/powermgr/thermal_manager/src/main/js/default/pages/index/index.css
+++ b/powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.css
@@ -1,24 +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.
- */
-
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/powermgr/thermal_manager/src/main/js/default/pages/index/index.hml b/powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.hml
similarity index 97%
rename from powermgr/thermal_manager/src/main/js/default/pages/index/index.hml
rename to powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.hml
index eeaf6a3fc3d3611dc94827c5e1a9f390513b6ed8..936e04ebdb33a919d0ce918652dac1da8bb6ec92 100644
--- a/powermgr/thermal_manager/src/main/js/default/pages/index/index.hml
+++ b/powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.hml
@@ -1,20 +1,20 @@
-
-
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/powermgr/thermal_manager/src/main/js/default/pages/index/index.js b/powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.js
similarity index 67%
rename from powermgr/thermal_manager/src/main/js/default/pages/index/index.js
rename to powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.js
index 8b86d31dd948dd673cd4293b0e2d9ea47319f797..98d5015730432a1bf9b5993db62e7335e022f45b 100644
--- a/powermgr/thermal_manager/src/main/js/default/pages/index/index.js
+++ b/powermgr/thermal_manager/src/main/js/MainAbility/pages/index/index.js
@@ -1,43 +1,30 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import app from '@system.app'
-
-import {Core, ExpectExtend} 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'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
-
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import app from '@system.app'
+
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
+}
diff --git a/powermgr/thermal_manager/src/main/js/TestAbility/app.js b/powermgr/thermal_manager/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/powermgr/thermal_manager/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/powermgr/thermal_manager/src/main/js/TestAbility/i18n/en-US.json b/powermgr/thermal_manager/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/powermgr/thermal_manager/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/powermgr/thermal_manager/src/main/js/TestAbility/i18n/zh-CN.json b/powermgr/thermal_manager/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/powermgr/thermal_manager/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/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.css b/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/powermgr/thermal_manager/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/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.hml b/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.js b/powermgr/thermal_manager/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/powermgr/thermal_manager/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/powermgr/thermal_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/powermgr/thermal_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/powermgr/thermal_manager/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'] + '.TestAbility'
+
+ 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/powermgr/thermal_manager/src/main/js/default/test/List.test.js b/powermgr/thermal_manager/src/main/js/test/List.test.js
similarity index 80%
rename from powermgr/thermal_manager/src/main/js/default/test/List.test.js
rename to powermgr/thermal_manager/src/main/js/test/List.test.js
index f42c57c0a79c605c81a5a8f2b20f26fc30c2c11c..6f217c276cdba5b4605ff68793e86d9ddc1c81b5 100644
--- a/powermgr/thermal_manager/src/main/js/default/test/List.test.js
+++ b/powermgr/thermal_manager/src/main/js/test/List.test.js
@@ -12,4 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./thermal_unittest.test.js')
\ No newline at end of file
+import appInfoTest_thermal_1 from './thermal_unittest.test.js'
+export default function testsuite() {
+appInfoTest_thermal_1()
+}
diff --git a/powermgr/thermal_manager/src/main/js/default/test/thermal_common_event.test.js b/powermgr/thermal_manager/src/main/js/test/thermal_common_event.test.js
similarity index 96%
rename from powermgr/thermal_manager/src/main/js/default/test/thermal_common_event.test.js
rename to powermgr/thermal_manager/src/main/js/test/thermal_common_event.test.js
index 69439f9ef1be0da15d25ed238c0b43451eea9be1..e85fb2a03b078ceb26b7797bdd6f684a4c5864f6 100644
--- a/powermgr/thermal_manager/src/main/js/default/test/thermal_common_event.test.js
+++ b/powermgr/thermal_manager/src/main/js/test/thermal_common_event.test.js
@@ -1,73 +1,74 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import commonEvent from '@ohos.commonEvent';
-import thermal from "@ohos.thermal"
-
-describe('appInfoTest_thermal_3', function () {
- console.log("*************Thermal commonEvent Test Begin*************");
-
- /**
- * @tc.number ThermalCommonEventTest_001
- * @tc.name subscribe thermal level changed common event
- * @tc.desc Thermal acquisition kit
- */
- it('ThermalCommonEventTest_001', 0, function (done) {
- createSubscriber();
- done();
- })
- console.log("*************Thermal commonEvent Test End*************");
-})
-
-function createSubscriber() {
- let commonEventSubscribeInfo = {
- events: [commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED],
- };
- commonEvent.createSubscriber(commonEventSubscribeInfo)
- .then(subscriber => {
- console.info('createSubscriber success');
- let mySubscriber = subscriber;
- console.log(subscriber);
-
- if (subscriber == "" || subscriber == undefined || subscriber == null) {
- console.info("createSubscriber failed");
- }
- mySubscriber.getCode()
- .then((data) => {
- console.info('Subscriber getCode success : ' + JSON.stringify(data));
- }).catch((error) => {
- console.error('Subscriber getCode error because: ' + JSON.stringify(error));
- })
- mySubscriber.getData()
- .then((data) => {
- console.info('Subscriber getData success : ' + JSON.stringify(data));
- }).catch((error) => {
- console.error('Subscriber getData error because: ' + JSON.stringify(error));
- })
- console.info('subscribe begin ');
-
- commonEvent.subscribe(mySubscriber, (error, commonEventData) => {
- console.error('err code: ' + JSON.stringify(error));
- console.info('subscribe callback: ' + JSON.stringify(commonEventData));
- console.info("commonEventData event: " + commonEventData.event);
- console.info("commonEventData bundleName: " + commonEventData.bundleName);
- console.info("commonEventData data: " + commonEventData.data);
- console.info("commonEventData parameter: " + commonEventData.parameters[0]);
- let level = -1;
- expect(level >= thermal.ThermalLevel.COOL && warm <= level.ThermalLevel.EMERGENCY).assertTrue();
- });
- }).catch((error) => {
- console.error('Operation failed. Cause: ' + JSON.stringify(error));
- });
-}
\ No newline at end of file
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonEvent';
+import thermal from "@ohos.thermal"
+
+export default function appInfoTest_thermal_3() {
+describe('appInfoTest_thermal_3', function () {
+ console.log("*************Thermal commonEvent Test Begin*************");
+
+ /**
+ * @tc.number ThermalCommonEventTest_001
+ * @tc.name subscribe thermal level changed common event
+ * @tc.desc Thermal acquisition kit
+ */
+ it('ThermalCommonEventTest_001', 0, function (done) {
+ createSubscriber();
+ done();
+ })
+ console.log("*************Thermal commonEvent Test End*************");
+})
+
+function createSubscriber() {
+ let commonEventSubscribeInfo = {
+ events: [commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED],
+ };
+ commonEvent.createSubscriber(commonEventSubscribeInfo)
+ .then(subscriber => {
+ console.info('createSubscriber success');
+ let mySubscriber = subscriber;
+ console.log(subscriber);
+
+ if (subscriber == "" || subscriber == undefined || subscriber == null) {
+ console.info("createSubscriber failed");
+ }
+ mySubscriber.getCode()
+ .then((data) => {
+ console.info('Subscriber getCode success : ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('Subscriber getCode error because: ' + JSON.stringify(error));
+ })
+ mySubscriber.getData()
+ .then((data) => {
+ console.info('Subscriber getData success : ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('Subscriber getData error because: ' + JSON.stringify(error));
+ })
+ console.info('subscribe begin ');
+
+ commonEvent.subscribe(mySubscriber, (error, commonEventData) => {
+ console.error('err code: ' + JSON.stringify(error));
+ console.info('subscribe callback: ' + JSON.stringify(commonEventData));
+ console.info("commonEventData event: " + commonEventData.event);
+ console.info("commonEventData bundleName: " + commonEventData.bundleName);
+ console.info("commonEventData data: " + commonEventData.data);
+ console.info("commonEventData parameter: " + commonEventData.parameters[0]);
+ let level = -1;
+ expect(level >= thermal.ThermalLevel.COOL && warm <= level.ThermalLevel.EMERGENCY).assertTrue();
+ });
+ }).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+ });
+}}
diff --git a/powermgr/thermal_manager/src/main/js/default/test/thermal_performance.test.js b/powermgr/thermal_manager/src/main/js/test/thermal_performance.test.js
similarity index 93%
rename from powermgr/thermal_manager/src/main/js/default/test/thermal_performance.test.js
rename to powermgr/thermal_manager/src/main/js/test/thermal_performance.test.js
index d60391d521b5eff8c4b7c639130e436ed53fdd09..fb73e2fbd42d02f518e1e302c468873f31d9f95d 100644
--- a/powermgr/thermal_manager/src/main/js/default/test/thermal_performance.test.js
+++ b/powermgr/thermal_manager/src/main/js/test/thermal_performance.test.js
@@ -1,86 +1,88 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import thermal from "@ohos.thermal"
-import { describe, it, expect } from 'deccjsunit/index';
-
-describe('appInfoTest_thermal_4', function () {
- console.log("*************Thermal Performance Test Begin*************");
- performanceTest1();
- performanceTest2();
- performanceTest3();
- console.log("*************Thermal Performance Test End*************");
-})
-
-function performanceTest1() {
- let MAXNUM = 1000;
-
- /**
- * @tc.number ThermalPerformance_001
- * @tc.name test get thermal level
- * @tc.desc Thermal acquisition kit
- */
- it('ThermalPerformance_001', 0, function () {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- let level = thermal.getThermalLevel();
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime; //us
- console.info(`ThermalPerformance_001: Promise: getlevel Wait Time : ${waitTime}`);
- })
-}
-
-function performanceTest2() {
- let MAXNUM = 1000;
-
- /**
- * @tc.number ThermalPerformance_002
- * @tc.name subscribe thermal level
- * @tc.desc Thermal acquisition kit
- */
- it('ThermalPerformance_002', 0, function () {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- thermal.subscribeThermalLevel((level) => {
- console.info("hot level is: " + level);
- })
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime; //us
- console.info(`ThermalPerformance_002: Promise: subscribeThermalLevel Wait Time : ${waitTime}`);
- })
-}
-
-function performanceTest3() {
- let MAXNUM = 1000;
-
- /**
- * @tc.number ThermalPerformance_002
- * @tc.name subscribe thermal level
- * @tc.desc Thermal acquisition kit
- */
- it('ThermalPerformance_003', 0, function () {
- let startTime = new Date().getTime();
- for (let i = 0; i < MAXNUM; i++) {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe success.");
- });
- }
- let waitTime = new Date().getTime() - startTime;
- let avgTime = waitTime; //us
- console.info(`ThermalPerformance_003: Promise: unsubscribeThermalLevel Wait Time : ${waitTime}`);
- })
-}
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import thermal from "@ohos.thermal"
+import { describe, it, expect } from '@ohos/hypium';
+
+export default function appInfoTest_thermal_4() {
+describe('appInfoTest_thermal_4', function () {
+ console.log("*************Thermal Performance Test Begin*************");
+ performanceTest1();
+ performanceTest2();
+ performanceTest3();
+ console.log("*************Thermal Performance Test End*************");
+})
+
+function performanceTest1() {
+ let MAXNUM = 1000;
+
+ /**
+ * @tc.number ThermalPerformance_001
+ * @tc.name test get thermal level
+ * @tc.desc Thermal acquisition kit
+ */
+ it('ThermalPerformance_001', 0, function () {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ let level = thermal.getThermalLevel();
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime; //us
+ console.info(`ThermalPerformance_001: Promise: getlevel Wait Time : ${waitTime}`);
+ })
+}
+
+function performanceTest2() {
+ let MAXNUM = 1000;
+
+ /**
+ * @tc.number ThermalPerformance_002
+ * @tc.name subscribe thermal level
+ * @tc.desc Thermal acquisition kit
+ */
+ it('ThermalPerformance_002', 0, function () {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ thermal.subscribeThermalLevel((level) => {
+ console.info("hot level is: " + level);
+ })
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime; //us
+ console.info(`ThermalPerformance_002: Promise: subscribeThermalLevel Wait Time : ${waitTime}`);
+ })
+}
+
+function performanceTest3() {
+ let MAXNUM = 1000;
+
+ /**
+ * @tc.number ThermalPerformance_002
+ * @tc.name subscribe thermal level
+ * @tc.desc Thermal acquisition kit
+ */
+ it('ThermalPerformance_003', 0, function () {
+ let startTime = new Date().getTime();
+ for (let i = 0; i < MAXNUM; i++) {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe success.");
+ });
+ }
+ let waitTime = new Date().getTime() - startTime;
+ let avgTime = waitTime; //us
+ console.info(`ThermalPerformance_003: Promise: unsubscribeThermalLevel Wait Time : ${waitTime}`);
+ })
+}
+}
diff --git a/powermgr/thermal_manager/src/main/js/default/test/thermal_uint.test.js b/powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js
similarity index 96%
rename from powermgr/thermal_manager/src/main/js/default/test/thermal_uint.test.js
rename to powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js
index 84df85d08f771d90cd67d2d7c7899965a92ebd15..47940d479ce619d5ad34ac7ad8c1b0a0384520c2 100644
--- a/powermgr/thermal_manager/src/main/js/default/test/thermal_uint.test.js
+++ b/powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js
@@ -1,331 +1,332 @@
-// @ts-nocheck
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import app from '@system.app'
-import thermal from "@ohos.thermal"
-import ThermalLevel from "@ohos.thermal"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('appInfoTest_thermal_2', function () {
- console.log("*************Thermal API Test Begin*************");
- test1();
- test2();
- test3();
- test4();
- test5();
- test6();
- test7();
- test8();
- test9();
- test10();
- test11();
- test12();
- test13();
- console.log("*************Thermal API Test End*************");
-})
-
-function test1() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0010
- * @tc.name Thermal_JSTest0010
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0010', 0, async function (done) {
- console.info("enter");
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let cold = thermal.getThermalLevel();
- console.info("cold level is: " + cold);
- expect(cold >= thermal.ThermalLevel.COOL && cold <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 1);
- })
- })
-}
-
-function test2() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0020
- * @tc.name Thermal_JSTest0020
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0020', 0, async function (done) {
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let warm = thermal.getThermalLevel();
- console.info("warm level is: " + warm);
- expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 1);
- })
- })
-}
-
-function test3() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0030
- * @tc.name Thermal_JSTest0030
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0030', 0, async function (done) {
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let hot = thermal.getThermalLevel();
- console.info("hot level is: " + hot);
- expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 1);
- })
- })
-}
-
-function test4() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0040
- * @tc.name Thermal_JSTest0040
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0040', 0, async function (done) {
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let overheated = thermal.getThermalLevel();
- console.info("overheated level is: " + overheated);
- expect(overheated >= thermal.ThermalLevel.COOL &&
- overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 1);
- })
- })
-}
-
-function test5() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0050
- * @tc.name Thermal_JSTest0050
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0050', 0, async function (done) {
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let warning = thermal.getThermalLevel();
- console.info("warning level is: " + warning);
- expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 1);
- })
- })
-}
-
-function test6() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0060
- * @tc.name Thermal_JSTest0060
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0060', 0, async function (done) {
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let emergency = thermal.getThermalLevel();
- console.info("emergency level is: " + emergency);
- expect(emergency >= thermal.ThermalLevel.COOL &&
- emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 1);
- })
- })
-}
-
-function test7() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0070
- * @tc.name Thermal_JSTest0070
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0070', 0, async function (done) {
- thermal.subscribeThermalLevel((cool) => {
- console.info("warm level is: " + cool);
- expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 4);
- })
- })
-}
-
-function test8() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0080
- * @tc.name Thermal_JSTest0080
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0080', 0, async function (done) {
- thermal.subscribeThermalLevel((warm) => {
- console.info("warm level is: " + warm);
- expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 4);
- })
- })
-}
-
-function test9() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0090
- * @tc.name Thermal_JSTest0090
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0090', 0, async function (done) {
- thermal.subscribeThermalLevel((hot) => {
- console.info("hot level is: " + hot);
- expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 2);
- })
- })
-
-}
-
-function test10() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0100
- * @tc.name Thermal_JSTest0100
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0100', 0, async function (done) {
- thermal.subscribeThermalLevel((overheated) => {
- console.info("overheated level is: " + overheated);
- expect(overheated >= thermal.ThermalLevel.COOL &&
- overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 2);
- })
- })
-}
-
-function test11() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0110
- * @tc.name Thermal_JSTest0110
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0110', 0, async function (done) {
- thermal.subscribeThermalLevel((warning) => {
- console.info("warning level is: " + warning);
- expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 4);
- })
- })
-}
-
-function test12() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0120
- * @tc.name Thermal_JSTest0120
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0120', 0, async function (done) {
- thermal.subscribeThermalLevel((emergency) => {
- console.info("emergency level is: " + emergency);
- expect(emergency >= thermal.ThermalLevel.COOL && emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 4);
- })
- })
-}
-
-function test13() {
- const MSEC_1000 = 1000;
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0130
- * @tc.name Thermal_JSTest0130
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_JSTest0130', 0, async function (done) {
- thermal.subscribeThermalLevel((cool) => {
- console.info("cool level is: " + cool);
- expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 4);
- })
- })
-}
\ No newline at end of file
+// @ts-nocheck
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import app from '@system.app'
+import thermal from "@ohos.thermal"
+import ThermalLevel from "@ohos.thermal"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export default function appInfoTest_thermal_2() {
+describe('appInfoTest_thermal_2', function () {
+ console.log("*************Thermal API Test Begin*************");
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ test9();
+ test10();
+ test11();
+ test12();
+ test13();
+ console.log("*************Thermal API Test End*************");
+})
+
+function test1() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0010
+ * @tc.name Thermal_JSTest0010
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0010', 0, async function (done) {
+ console.info("enter");
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let cold = thermal.getThermalLevel();
+ console.info("cold level is: " + cold);
+ expect(cold >= thermal.ThermalLevel.COOL && cold <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 1);
+ })
+ })
+}
+
+function test2() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0020
+ * @tc.name Thermal_JSTest0020
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0020', 0, async function (done) {
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let warm = thermal.getThermalLevel();
+ console.info("warm level is: " + warm);
+ expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 1);
+ })
+ })
+}
+
+function test3() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0030
+ * @tc.name Thermal_JSTest0030
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0030', 0, async function (done) {
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let hot = thermal.getThermalLevel();
+ console.info("hot level is: " + hot);
+ expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 1);
+ })
+ })
+}
+
+function test4() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0040
+ * @tc.name Thermal_JSTest0040
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0040', 0, async function (done) {
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let overheated = thermal.getThermalLevel();
+ console.info("overheated level is: " + overheated);
+ expect(overheated >= thermal.ThermalLevel.COOL &&
+ overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 1);
+ })
+ })
+}
+
+function test5() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0050
+ * @tc.name Thermal_JSTest0050
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0050', 0, async function (done) {
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let warning = thermal.getThermalLevel();
+ console.info("warning level is: " + warning);
+ expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 1);
+ })
+ })
+}
+
+function test6() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0060
+ * @tc.name Thermal_JSTest0060
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0060', 0, async function (done) {
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let emergency = thermal.getThermalLevel();
+ console.info("emergency level is: " + emergency);
+ expect(emergency >= thermal.ThermalLevel.COOL &&
+ emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 1);
+ })
+ })
+}
+
+function test7() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0070
+ * @tc.name Thermal_JSTest0070
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0070', 0, async function (done) {
+ thermal.subscribeThermalLevel((cool) => {
+ console.info("warm level is: " + cool);
+ expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 4);
+ })
+ })
+}
+
+function test8() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0080
+ * @tc.name Thermal_JSTest0080
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0080', 0, async function (done) {
+ thermal.subscribeThermalLevel((warm) => {
+ console.info("warm level is: " + warm);
+ expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 4);
+ })
+ })
+}
+
+function test9() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0090
+ * @tc.name Thermal_JSTest0090
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0090', 0, async function (done) {
+ thermal.subscribeThermalLevel((hot) => {
+ console.info("hot level is: " + hot);
+ expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 2);
+ })
+ })
+
+}
+
+function test10() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0100
+ * @tc.name Thermal_JSTest0100
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0100', 0, async function (done) {
+ thermal.subscribeThermalLevel((overheated) => {
+ console.info("overheated level is: " + overheated);
+ expect(overheated >= thermal.ThermalLevel.COOL &&
+ overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 2);
+ })
+ })
+}
+
+function test11() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0110
+ * @tc.name Thermal_JSTest0110
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0110', 0, async function (done) {
+ thermal.subscribeThermalLevel((warning) => {
+ console.info("warning level is: " + warning);
+ expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 4);
+ })
+ })
+}
+
+function test12() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0120
+ * @tc.name Thermal_JSTest0120
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0120', 0, async function (done) {
+ thermal.subscribeThermalLevel((emergency) => {
+ console.info("emergency level is: " + emergency);
+ expect(emergency >= thermal.ThermalLevel.COOL && emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 4);
+ })
+ })
+}
+
+function test13() {
+ const MSEC_1000 = 1000;
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0130
+ * @tc.name Thermal_JSTest0130
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_JSTest0130', 0, async function (done) {
+ thermal.subscribeThermalLevel((cool) => {
+ console.info("cool level is: " + cool);
+ expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 4);
+ })
+ })
+}}
diff --git a/powermgr/thermal_manager/src/main/js/default/test/thermal_unittest.test.js b/powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js
similarity index 93%
rename from powermgr/thermal_manager/src/main/js/default/test/thermal_unittest.test.js
rename to powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js
index 1da7f1376dd2c489856b986b52134c1f1844d13a..22d72718262c9318b306fe11c1cdff2b6af7bba0 100644
--- a/powermgr/thermal_manager/src/main/js/default/test/thermal_unittest.test.js
+++ b/powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js
@@ -1,69 +1,70 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import app from '@system.app'
-import thermal from "@ohos.thermal"
-import ThermalLevel from "@ohos.thermal"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-const MSEC_1000 = 1000;
-
-describe('appInfoTest_thermal_1', function () {
- console.log("*************Thermal API Test Begin*************");
- test14();
- test15();
-})
-
-function test14() {
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0010
- * @tc.name Thermal_014
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_014', 0, async function (done) {
- console.info("enter");
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- let level = thermal.getThermalLevel();
- console.info("level is: " + level);
- expect(level >= 0 && level <= 6).assertTrue();
- resolve();
- done();
- }, MSEC_1000 * 4);
- })
- })
-}
-
-function test15() {
-
- /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0020
- * @tc.name Thermal_015
- * @tc.desc Thermal acquisition kit
- */
- it('Thermal_015', 0, async function (done) {
- thermal.subscribeThermalLevel((level) => {
- console.info("level is: " + level);
- expect(level >= 0 && level <= 6).assertTrue();
- done();
- })
- await new Promise((resolve, reject) => {
- setTimeout(() => {
- thermal.unsubscribeThermalLevel(() => {
- console.info("unsubscribe successfully!");
- });
- resolve();
- }, MSEC_1000 * 4);
- })
- })
-}
\ No newline at end of file
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import app from '@system.app'
+import thermal from "@ohos.thermal"
+import ThermalLevel from "@ohos.thermal"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+const MSEC_1000 = 1000;
+
+export default function appInfoTest_thermal_1() {
+describe('appInfoTest_thermal_1', function () {
+ console.log("*************Thermal API Test Begin*************");
+ test14();
+ test15();
+})
+
+function test14() {
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0010
+ * @tc.name Thermal_014
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_014', 0, async function (done) {
+ console.info("enter");
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let level = thermal.getThermalLevel();
+ console.info("level is: " + level);
+ expect(level >= 0 && level <= 6).assertTrue();
+ resolve();
+ done();
+ }, MSEC_1000 * 4);
+ })
+ })
+}
+
+function test15() {
+
+ /* @tc.number USB_PowerSystem_ThermalManager_JSTest_0020
+ * @tc.name Thermal_015
+ * @tc.desc Thermal acquisition kit
+ */
+ it('Thermal_015', 0, async function (done) {
+ thermal.subscribeThermalLevel((level) => {
+ console.info("level is: " + level);
+ expect(level >= 0 && level <= 6).assertTrue();
+ done();
+ })
+ await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ thermal.unsubscribeThermalLevel(() => {
+ console.info("unsubscribe successfully!");
+ });
+ resolve();
+ }, MSEC_1000 * 4);
+ })
+ })
+}}
diff --git a/powermgr/thermal_manager/src/main/resources/base/element/string.json b/powermgr/thermal_manager/src/main/resources/base/element/string.json
index 83554c4c170fbc25754272b646b6291df70afba5..0568991c6854f1e86bc8e12c0ccb9e02d9c69ed9 100644
--- a/powermgr/thermal_manager/src/main/resources/base/element/string.json
+++ b/powermgr/thermal_manager/src/main/resources/base/element/string.json
@@ -7,6 +7,22 @@
{
"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/telephony/telephonyjstest/call_manager/BUILD.gn b/telephony/telephonyjstest/call_manager/BUILD.gn
index afa53e6cee41b46e5081cd34f2bbac05e4451715..81582258dd8e412c4874db5560f6d19e5126237a 100644
--- a/telephony/telephonyjstest/call_manager/BUILD.gn
+++ b/telephony/telephonyjstest/call_manager/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/BUILD.gn b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/BUILD.gn
index 235315030f64c759e42575ff2e3e7af9a5cd100e..db6294d474ab7854545c530a40953b63c3948a6f 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/BUILD.gn
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/BUILD.gn
@@ -1,31 +1,33 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsCallManagerIms2CallTest") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsCallManagerIms2CallTest"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsCallManagerIms2CallTest") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsCallManagerIms2CallTest"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/Test.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/Test.json
index 37539e4d767001a99fcab93496aaba1af1c4ae60..b6f4493338f3c4ad99b03002a32fce1eff818206 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/Test.json
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/Test.json
@@ -1,18 +1,20 @@
-{
- "description": "Configuration for ActsCallManagerIms2CallTest Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "1800000",
- "package": "com.ohos.actscallmanagerims2calltest",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "$module.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
+{
+ "description": "Configuration for ActsCallManagerIms2CallTest Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "1800000",
+ "bundle-name": "com.ohos.actscallmanagerims2calltest",
+ "package-name": "com.ohos.actscallmanagerims2calltest",
+ "shell-timeout": "1800000",
+ "testcase-timeout": "30000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "$module.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 2f9470d82c49675a64972657d8d367cd95e51c63..0000000000000000000000000000000000000000
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/element/string.json
deleted file mode 100644
index 359c05368eaa43e301bc83ff7080b351f969e715..0000000000000000000000000000000000000000
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "CallManager"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/config.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json
similarity index 67%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/config.json
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json
index 4f0547a2eadaf8bdc5f7192cd5ec9ebee857aae3..51e031a98508f38930953245f06600a405b3b334 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/config.json
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json
@@ -1,107 +1,140 @@
-{
- "app": {
- "bundleName": "com.ohos.actscallmanagerims2calltest",
- "vendor": "ohos",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Release"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.ohos.actscallmanagerims2calltest",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.ohos.actscallmanagerims2calltest.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.LOCATION",
- "reason": "need use ohos.permission.LOCATION"
- },
- {
- "name":"ohos.permission.SET_TELEPHONY_STATE",
- "reason":"need use ohos.permission.SET_TELEPHONY_STATE"
- },
- {
- "name":"ohos.permission.GET_TELEPHONY_STATE",
- "reason":"need use ohos.permission.GET_TELEPHONY_STATE"
- },
- {
- "name":"ohos.permission.PLACE_CALL",
- "reason":"need use ohos.permission.PLACE_CALL"
- },
- {
- "name":"ohos.permission.READ_CONTACTS",
- "reason":"need use ohos.permission.READ_CONTACTS"
- },
- {
- "name":"ohos.permission.WRITE_CONTACTS",
- "reason":"need use ohos.permission.WRITE_CONTACTS"
- },
- {
- "name":"ohos.permission.SEND_MESSAGES",
- "reason":"need use ohos.permission.SEND_MESSAGES"
- },
- {
- "name":"ohos.permission.RECEIVE_SMS",
- "reason":"need use ohos.permission.RECEIVE_SMS"
- },
- {
- "name":"ohos.permission.READ_CALL_LOG",
- "reason":"need use ohos.permission.READ_CALL_LOG"
- },
- {
- "name":"ohos.permission.GET_NETWORK_INFO",
- "reason":"need use ohos.permission.GET_NETWORK_INFO"
- },
- {
- "name":"ohos.permission.INTERNET",
- "reason":"need use ohos.permission.INTERNET"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
+{
+ "app": {
+ "bundleName": "com.ohos.actscallmanagerims2calltest",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.actscallmanagerims2calltest",
+ "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.LOCATION",
+ "reason": "need use ohos.permission.LOCATION"
+ },
+ {
+ "name":"ohos.permission.SET_TELEPHONY_STATE",
+ "reason":"need use ohos.permission.SET_TELEPHONY_STATE"
+ },
+ {
+ "name":"ohos.permission.GET_TELEPHONY_STATE",
+ "reason":"need use ohos.permission.GET_TELEPHONY_STATE"
+ },
+ {
+ "name":"ohos.permission.PLACE_CALL",
+ "reason":"need use ohos.permission.PLACE_CALL"
+ },
+ {
+ "name":"ohos.permission.READ_CONTACTS",
+ "reason":"need use ohos.permission.READ_CONTACTS"
+ },
+ {
+ "name":"ohos.permission.WRITE_CONTACTS",
+ "reason":"need use ohos.permission.WRITE_CONTACTS"
+ },
+ {
+ "name":"ohos.permission.SEND_MESSAGES",
+ "reason":"need use ohos.permission.SEND_MESSAGES"
+ },
+ {
+ "name":"ohos.permission.RECEIVE_SMS",
+ "reason":"need use ohos.permission.RECEIVE_SMS"
+ },
+ {
+ "name":"ohos.permission.READ_CALL_LOG",
+ "reason":"need use ohos.permission.READ_CALL_LOG"
+ },
+ {
+ "name":"ohos.permission.GET_NETWORK_INFO",
+ "reason":"need use ohos.permission.GET_NETWORK_INFO"
+ },
+ {
+ "name":"ohos.permission.INTERNET",
+ "reason":"need use ohos.permission.INTERNET"
+ }
+ ],
+ "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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/app.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..9061142c591ef44ccf87c5c3733848ba948602fd
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/app.js
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/i18n/en-US.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/i18n/zh-CN.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.css
similarity index 93%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.css
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.css
index 6fda792753f2e15f22b529c7b90a82185b2770bf..5c52a87a04f583e9d5f4db1dd40d4eafdb9b6aeb 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.css
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.hml b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.js
similarity index 68%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.js
index 3d02d9362abc1703ec0b3f87e2cbb4c72cc6a992..4e0755497791c075400465e1416da5ea2696faff 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/pages/index/index.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/MainAbility/pages/index/index.js
@@ -1,48 +1,42 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file'
-import app from '@system.app'
-import device from '@system.device'
-import router from '@system.router'
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
- const configService = core.getDefaultService('config')
- this.timeout = 30000;
- configService.setConfig(this)
- require('../../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import app from '@system.app'
+import device from '@system.device'
+import router from '@system.router'
+import 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')
+
+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() {
+ },
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/app.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/app.js
similarity index 91%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/app.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/app.js
index c1a2274b034140503e7ef5347935c10c69a96d59..e64117c268be3c6776d11168032484d7b3324751 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/default/app.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/app.js
@@ -1,23 +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('TestApplication onCreate');
- },
- onDestroy() {
- console.info('TestApplication 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('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/i18n/en-US.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/i18n/zh-CN.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js
index e59ba2cb11d96ce94989874f552a12bceab2608a..485f8dab95f559f9806c596c11465ab2c45fc3ea 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js
@@ -1,1030 +1,1033 @@
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import call from '@ohos.telephony.call';
-import observer from '@ohos.telephony.observer';
-import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
-import {
- AUTO_ACCEPT_NUMBER,
- AUTO_ACCEPT_NUMBER2,
- PHONE_NUMBER_LENGTH_11,
- CALL_STATUS_DIALING,
- CALL_ID_NOT_EXIST,
- CALL_STATE_UNKNOWN,
- CALL_STATE_IDLE,
- DEFAULT_SLOT_ID,
- CALL_MODE_IMS,
- SLOT_ID_INVALID,
- PHONE_LIST2,
- RTT_MSG,
- CALL_MODE_SEND_RECEIVE,
- POS_700,
- POS_10,
- POS_LENGTH_300,
- POS_LENGTH_600,
- DEVICE_EARPIECE,
- BOUNDARY_NUMBER_INT,
- SENT_STRING_C,
- MINUS_VALUE,
- PHONE_NUMBER_LONG,
- NULL_PHONE_NUMBER,
- DIAL_CARRIER_TYPE,
- DIAL_SCENCE_CALL_PRIVILEGED,
- MEDIA_TYPE_VOICE,
- ROTATION_MINUS_1,
- IMAGE_LOCAL_ERROR_PATH,
- POS_Z_ERROR,
- RESTRICTION_TYPE_ROAMING_INCOMING,
- RESTRICTION_MODE_ACTIVATION,
- RIGHT_PASSWORD,
- RESTRICTION_TYPE_ALL_INCOMING,
- TRANSFER_TYPE_NOT_REACHABLE,
- TRANSFER_TYPE_UNCONDITIONAL,
- PHONE_NUMBER_AREA_LAND,
- CALL_TRANSFER_DISABLE,
- TRANSFER_TYPE_NO_REPLY,
- COMMAND_CALL_ERROR4,
- COMMAND_CALL_ERROR,
- CARMER_ID_NOT_EXIT,
- ZOOM_RATIO_MINUS_1_0,
- DIAL_SCENCE_CALL_NORMAL,
- DIAL_TYPE_OTT,
- EVENT_OTT_FUNCTION_UNSUPPORTED,
- TEL_CONFERENCE_IDLE
-} from './lib/Const.js';
-import {toString} from './lib/ApiToPromise.js';
-import {
- scenceInCalling,
- hangupCall2,
- hangupCall,
- callDetailsChangeOn,
- callId as gloabCallId,
- reachState,
- callDetailsChangeOff,
- reachCallEventState
-} from './lib/ScenceInCalling.js';
-const GETMAIN_CALLID_ERRO = -1;
-const REJECT_MESSAGE_STR = 'Hi,hello?';
-const REJECT_MESSAGE_NUM = 1234567890123456789012345678901234567890;
-const ERR_SLOT_ID = -1;
-const SLOTID = 0;
-const THE_THREE_NUMBER = '112';
-const DIAL_TYPE_ERR_CALL = 3;
-const TIME_OUT = 20000;
-const WAITING_TIME = 200;
-
-let callId = null;
-class RejectMessageOptions {
- constructor (str) {
- this.messageContent = str;
- }
-}
-class EmergencyNumberOptions {
- constructor (num) {
- this.slotId = num;
- }
-}
-class NumberFormatOptions {
- constructor (str) {
- this.countryCode = str;
- }
-}
-class CallAttributeOptions {
- constructor (accountNumber, speakerphoneOn, accountId, videoState, startTime,
- isEcc, callType, callId, callState, conferenceState) {
- this.accountNumber = accountNumber;
- this.speakerphoneOn = speakerphoneOn;
- this.accountId = accountId;
- this.videoState = videoState;
- this.startTime = startTime;
- this.isEcc = isEcc;
- this.callType = callType;
- this.callId = callId;
- this.callState = callState;
- this.conferenceState = conferenceState;
- }
-}
-
-const sleep = (time) => {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve();
- }, time);
- });
-};
-
-var callState = -1;
-var timing = 0;
-var endTime = 0;
-describe('CallManageImsCall', function () {
- beforeAll(async function (done) {
- try {
- console.log('Telephony_CallManager enableImsSwitch success');
- await call.setCallPreferenceMode(DEFAULT_SLOT_ID, CALL_MODE_IMS);
- console.log('Telephony_CallManager setCallPreferenceMode success');
- } catch (error) {
- console.log(`Telephony_CallManager setCallPreferenceMode or enableImsSwitch error,error:${toString(error)}`);
- }
- done();
- });
-
- afterEach(async function () {
- try {
- const CURRENT_TIME = new Date().valueOf();
- const TEMP_CALL_ID = 10;
- const IS_ECC = true;
- const SPEAK_ON = true;
- let callAttributeOptions = new CallAttributeOptions(AUTO_ACCEPT_NUMBER, SPEAK_ON, DEFAULT_SLOT_ID,
- MEDIA_TYPE_VOICE, CURRENT_TIME, IS_ECC, DIAL_TYPE_OTT, TEMP_CALL_ID, CALL_STATUS_DIALING,
- TEL_CONFERENCE_IDLE);
- console.log(`Telephony_CallManager ${toString(callAttributeOptions)}`);
- expect(callAttributeOptions.accountNumber === AUTO_ACCEPT_NUMBER).assertTrue();
- expect(callAttributeOptions.speakerphoneOn === SPEAK_ON).assertTrue();
- expect(callAttributeOptions.accountId === DEFAULT_SLOT_ID).assertTrue();
- expect(callAttributeOptions.videoState === MEDIA_TYPE_VOICE).assertTrue();
- expect(callAttributeOptions.startTime === CURRENT_TIME).assertTrue();
- expect(callAttributeOptions.isEcc === IS_ECC).assertTrue();
- expect(callAttributeOptions.callType === DIAL_TYPE_OTT).assertTrue();
- expect(callAttributeOptions.callId === TEMP_CALL_ID).assertTrue();
- expect(callAttributeOptions.callState === CALL_STATUS_DIALING).assertTrue();
- expect(callAttributeOptions.conferenceState === TEL_CONFERENCE_IDLE).assertTrue();
- } catch (error) {
- console.log(`Telephony_CallManager ${toString(error)}`);
- }
- try {
- let callState = await call.getCallState();
- console.log(`Telephony_CallManager callState ${callState} ${gloabCallId}`);
- if (callState === CALL_STATE_UNKNOWN || callState === CALL_STATE_IDLE) {
- return;
- }
- if (gloabCallId) {
- let data = await hangupCall('Telephony_CallManager', gloabCallId);
- console.log(`Telephony_CallManager hangupCall success ${toString(data)}`);
- }
- } catch (error) {
- console.log('Telephony_CallManager hangupCall or getCallState error');
- }
- });
-
- afterAll(function () {
- observer.off('callStateChange');
- callDetailsChangeOff();
- console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall');
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400
- * @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID,
- * by callback,the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400';
- call.enableLteEnhanceMode(SLOT_ID_INVALID, (error, data) => {
- if (error) {
- console.log(`${caseName} enableLteEnhanceMode error,case success,error:${toString(error)}`);
- done();
- return;
- }
- expect().assertFail();
- console.log(`${caseName} enableLteEnhanceMode success,case failed,data:${toString(data)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400
- * @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID by promise,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400';
- call.enableLteEnhanceMode(SLOT_ID_INVALID).then(data => {
- expect().assertFail();
- console.log(`${caseName} enableLteEnhanceMode success,case failed,data:${toString(data)}`);
- done();
- }).catch(error => {
- console.log(`${caseName} enableLteEnhanceMode error,case success,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400
- * @tc.name Run the function disableLteEnhanceMode by args slotId SLOT_ID_INVALID,
- * by callback,the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400';
- call.disableLteEnhanceMode(SLOT_ID_INVALID, (error, data) => {
- if (error) {
- console.log(`${caseName} disableLteEnhanceMode error,case success,error:${toString(error)}`);
- done();
- return;
- }
- expect().assertFail();
- console.log(`${caseName} disableLteEnhanceMode success,case failed,data:${toString(data)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400
- * @tc.name Run the function disableLteEnhanceMode by args slotId SLOT_ID_INVALID by promise,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400';
- call.disableLteEnhanceMode(SLOT_ID_INVALID).then(data => {
- expect().assertFail();
- console.log(`${caseName} disableLteEnhanceMode success,case failed,data:${toString(data)}`);
- done();
- }).catch(error => {
- console.log(`${caseName} disableLteEnhanceMode error,case success,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400
- * @tc.name Run the function isLteEnhanceModeEnabled by args slotId SLOT_ID_INVALID by callback,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400';
- call.isLteEnhanceModeEnabled(SLOT_ID_INVALID, (error, data) => {
- if (error) {
- console.log(`${caseName} isLteEnhanceModeEnabled error,case success,error:${toString(error)}`);
- done();
- return;
- }
- expect().assertFail();
- console.log(`${caseName} isLteEnhanceModeEnabled success,case failed,data:${toString(data)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400
- * @tc.name Run the function isLteEnhanceModeEnabled by args slotId SLOT_ID_INVALID by promise,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400';
- call.isLteEnhanceModeEnabled(SLOT_ID_INVALID).then(data => {
- expect().assertFail();
- console.log(`${caseName} isLteEnhanceModeEnabled success,case failed,data:${toString(data)}`);
- done();
- }).catch(error => {
- console.log(`${caseName} isLteEnhanceModeEnabled error,case success,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_startRTT_Async_0200
- * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_startRTT_Async_0200', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_startRTT_Async_0200';
- call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG, (error, data) => {
- if (error) {
- console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`);
- done();
- return;
- }
- expect().assertFail();
- console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_startRTT_Promise_0200
- * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_startRTT_Promise_0200', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_startRTT_Promise_0200';
- call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG).then(data => {
- expect().assertFail();
- console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`);
- done();
- }).catch(error => {
- console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_stopRTT_Async_0200
- * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_stopRTT_Async_0200', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_stopRTT_Async_0200';
- call.stopRTT(CALL_ID_NOT_EXIST, (error, data) => {
- if (error) {
- console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`);
- done();
- return;
- }
- expect().assertFail();
- console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_IMS_stopRTT_Promise_0200
- * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_IMS_stopRTT_Promise_0200', 0, function (done) {
- let caseName = 'Telephony_CallManager_IMS_stopRTT_Promise_0200';
- call.stopRTT(CALL_ID_NOT_EXIST).then(data => {
- expect().assertFail();
- console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`);
- done();
- }).catch(error => {
- console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`);
- done();
- });
- });
-
-
- /**
- * @tc.number Telephony_CallManager_controlCamera_Async_0200
- * @tc.name Dial a call and after answering the call,run function controlCamera by
- * args cameraId CARMER_ID_NOT_EXIT by callback,
- * the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_controlCamera_Async_0200', 0, function (done) {
- let caseName = 'Telephony_CallManager_controlCamera_Async_0200';
- scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER2,
- checkState:CALL_STATUS_DIALING
- }).then(data => {
- callId = data.callId;
- let cameraId = CARMER_ID_NOT_EXIT;
- call.controlCamera(cameraId, (error) => {
- if (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- hangupCall2(caseName, done, callId);
- return;
- }
- console.log(`${caseName} case failed`);
- expect().assertFail();
- hangupCall2(caseName, done, callId);
- });
- }).catch(error => {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_controlCamera_Promise_0200
- * @tc.name Dial a call and after answering the call,run function controlCamera by args cameraId
- * CARMER_ID_NOT_EXIT by promise,the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_controlCamera_Promise_0200', 0, async function (done) {
- let caseName = 'Telephony_CallManager_controlCamera_Promise_0200';
- let cameraId = CARMER_ID_NOT_EXIT;
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER2,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- await call.controlCamera(cameraId);
- console.log(`${caseName} case failed`);
- expect().assertFail();
- } catch (err) {
- console.log(`${caseName} case success. error:${toString(err)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_setPreviewWindow_Async_0300
- * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
- * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
- * the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setPreviewWindow_Async_0300', 0, function (done) {
- let caseName = 'Telephony_CallManager_setPreviewWindow_Async_0300';
- scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- }).then(data => {
- callId = data.callId;
- let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
- call.setPreviewWindow(info, (error) => {
- if (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- hangupCall2(caseName, done, callId);
- return;
- }
- console.log(`${caseName} case faild`);
- expect().assertFail();
- hangupCall2(caseName, done, callId);
- });
- }).catch(error => {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_setPreviewWindow_Promise_0300
- * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
- * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setPreviewWindow_Promise_0300', 0, async function (done) {
- let caseName = 'Telephony_CallManager_setPreviewWindow_Promise_0300';
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
- await call.setPreviewWindow(info);
- console.log(`${caseName} case faild`);
- expect().assertFail();
- } catch (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_setDisplayWindow_Async_0300
- * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
- * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
- * the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setDisplayWindow_Async_0300', 0, async function (done) {
- let caseName = 'Telephony_CallManager_setDisplayWindow_Async_0300';
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
- await call.setDisplayWindow(info);
- console.log(`${caseName} case faild`);
- expect().assertFail();
- } catch (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_setDisplayWindow_Promise_0300
- * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
- * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
- * the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) {
- let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300';
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
- await call.setDisplayWindow(info);
- console.log(`${caseName} case faild`);
- expect().assertFail();
- } catch (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_setCameraZoom_Async_0400
- * @tc.name Dial a call and after answering the call,run function setCameraZoom by args
- * zoomRatio ZOOM_RATIO_MINUS_1_0 by callback,the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) {
- let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400';
- scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER2,
- checkState:CALL_STATUS_DIALING
- }).then(data => {
- callId = data.callId;
- call.setCameraZoom(ZOOM_RATIO_MINUS_1_0, (error) => {
- if (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- hangupCall2(caseName, done, callId);
- return;
- }
- console.log(`${caseName} case failed`);
- expect().assertFail();
- hangupCall2(caseName, done, callId);
- });
- }).catch(error => {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_setCameraZoom_Promise_0400
- * @tc.name Dial a call and after answering the call,run function setCameraZoom by args
- * zoomRatio ZOOM_RATIO_MINUS_1_0 by promise,the function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setCameraZoom_Promise_0400', 0, async function (done) {
- let caseName = 'Telephony_CallManager_setCameraZoom_Promise_0400';
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- await call.setCameraZoom(ZOOM_RATIO_MINUS_1_0);
- console.log(`${caseName} case failed`);
- expect().assertFail();
- } catch (error) {
- console.log(`${caseName} error,case success,error:${toString(error)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_setPausePicture_Async_0500
- * @tc.name Dial a call and after answering the call,run function setPausePicture by args
- * path IMAGE_LOCAL_ERROR_PATH by callback,the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setPausePicture_Async_0500', 0, function (done) {
- let caseName = 'Telephony_CallManager_setPausePicture_Async_0500';
- scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- }).then(data => {
- callId = data.callId;
- call.setPausePicture(IMAGE_LOCAL_ERROR_PATH, (error) => {
- if (error) {
- console.log(`${caseName} case success,error:${toString(error)}`);
- hangupCall2(caseName, done, callId);
- return;
- }
- console.log(`${caseName} success,case failed`);
- hangupCall2(caseName, done, callId);
- });
- }).catch(error => {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_setPausePicture_Promise_0500
- * @tc.name Dial a call and after answering the call,run function setPausePicture
- * by args path IMAGE_LOCAL_ERROR_PATH by promise,
- * the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setPausePicture_Promise_0500', 0, async function (done) {
- let caseName = 'Telephony_CallManager_setPausePicture_Promise_0500';
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- await call.setPausePicture(IMAGE_LOCAL_ERROR_PATH);
- console.log(`${caseName} success,case failed`);
- } catch (error) {
- console.log(`${caseName} case success,error:${toString(error)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_setDeviceDirection_Async_0500
- * @tc.name Dial a call and after answering the call,run function setDeviceDirection
- * by args rotation ROTATION_MINUS_1 by callback,the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setDeviceDirection_Async_0500', 0, function (done) {
- let caseName = 'Telephony_CallManager_setDeviceDirection_Async_0500';
- scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER,
- checkState:CALL_STATUS_DIALING
- }).then(data => {
- callId = data.callId;
- call.setDeviceDirection(ROTATION_MINUS_1, (error) => {
- if (error) {
- console.log(`${caseName} success, case success`);
- hangupCall2(caseName, done, callId);
- return;
- }
- console.log(`${caseName} error,case failed,error:${toString(error)}`);
- expect().assertFail();
- hangupCall2(caseName, done, callId);
- });
- }).catch(error => {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_setDeviceDirection_Promise_0500
- * @tc.name Dial a call and after answering the call,run function setDeviceDirection
- * by args rotation ROTATION_MINUS_1 by promise,the callback function return error
- * @tc.desc Function test
- */
- it('Telephony_CallManager_setDeviceDirection_Promise_0500', 0, async function (done) {
- let caseName = 'Telephony_CallManager_setDeviceDirection_Promise_0500';
- try {
- let data = await scenceInCalling({
- caseName:caseName,
- phoneNumber:AUTO_ACCEPT_NUMBER2,
- checkState:CALL_STATUS_DIALING
- });
- callId = data.callId;
- } catch (error) {
- console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
- done();
- return;
- }
- try {
- await call.setDeviceDirection(ROTATION_MINUS_1);
- console.log(`${caseName} success,case error`);
- expect().assertFail();
- } catch (error) {
- console.log(`${caseName} case success,error:${toString(error)}`);
- }
- hangupCall2(caseName, done, callId);
- });
-
- /**
- * @tc.number Telephony_CallManager_getCallState_Async_0100
- * @tc.name To get the idle call status, call getCallState() to get the current call status.
- * call.CALL_STATE_IDLE is returned
- * @tc.desc Function test
- */
- it('Telephony_CallManager_getCallState_Async_0100', 0, async function (done) {
- call.getCallState((err, data) => {
- if (err) {
- console.log(`Telephony_CallManager_getCallState_Async_0100 : err = ${err.message}`);
- expect().assertFail();
- done();
- return;
- }
- expect(data == call.CALL_STATE_IDLE ||
- data == call.CALL_STATE_UNKNOWN ||
- data == call.CALL_STATE_RINGING ||
- data == call.CALL_STATE_OFFHOOK).assertTrue();
- console.log(`Telephony_CallManager_getCallState_Async_0100 finish data = ${data}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_getCallState_Promise_0100
- * @tc.name To get the idle call status, call getCallState() to get the current call status.
- * call.CALL_STATE_IDLE is returned
- * @tc.desc Function test
- */
- it('Telephony_CallManager_getCallState_Promise_0100', 0, async function (done) {
- try {
- var data = await call.getCallState();
- expect(data == call.CALL_STATE_IDLE ||
- data == call.CALL_STATE_UNKNOWN ||
- data == call.CALL_STATE_RINGING ||
- data == call.CALL_STATE_OFFHOOK).assertTrue();
- console.log(`Telephony_CallManager_getCallState_Promise_0100 finish data = ${data}`);
- done();
- } catch (err) {
- console.log(`Telephony_CallManager_getCallState_Promise_0100 : err = ${err.message}`);
- expect().assertFail();
- done();
-
- }
- });
-
- /**
- * @tc.number Telephony_CallManager_hasCall_Async_0400
- * @tc.name When idle, hasCall() is called to confirm that there is no current call,returning false
- * @tc.desc Function test
- */
- it('Telephony_CallManager_hasCall_Async_0400', 0, async function (done) {
- call.hasCall((err, data) => {
- if (err) {
- console.log('Telephony_CallManager_hasCall_Async_0400 fail');
- expect().assertFail();
- done();
- return;
- }
- console.log(`Telephony_CallManager_hasCall_Async_0400 finish data = ${data}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_hasCall_Promise_0400
- * @tc.name When idle, hasCall() is called to confirm that there is no current call, returning false
- * @tc.desc Function test
- */
- it('Telephony_CallManager_hasCall_Promise_0400', 0, async function (done) {
- try {
- var data = await call.hasCall();
- console.log(`Telephony_CallManager_hasCall_Promise_0400 finish data = ${data}`);
- done();
- } catch (err) {
- console.log('Telephony_CallManager_hasCall_Promise_0400 fail');
- expect().assertFail();
- done();
-
- }
- });
-
- /**
- * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0100
- * @tc.name PhoneNumber is 100000000000. Call formatPhoneNumber() to format the number.
- * The return value is 10 000 000 0000
- * @tc.desc Function test
- */
- it('Telephony_CallManager_formatPhoneNumber_Async_0100', 0, async function (done) {
- call.formatPhoneNumber('100000000000', (err, data) => {
- if (err) {
- console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 err = ${err.message}`);
- console.log('Telephony_CallManager_formatPhoneNumber_Async_0100 fail');
- expect().assertFail();
- done();
- return;
- }
- expect(data === '10 000 000 0000').assertTrue();
- console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 finish data = ${data}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0100
- * @tc.name PhoneNumber is 2000000. Call formatPhoneNumber() to format the number.
- * The return value is 200 0000
- * @tc.desc Function test
- */
- it('Telephony_CallManager_formatPhoneNumber_Promise_0100', 0, async function (done) {
- try {
- var data = await call.formatPhoneNumber('2000000');
- expect(data === '200 0000').assertTrue();
- console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0100 finish data = ${data}`);
- done();
- } catch (err) {
- console.log('Telephony_CallManager_formatPhoneNumber_Promise_0100 fail');
- expect().assertFail();
- done();
-
- }
- });
-
- /**
- * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0200
- * @tc.name testFormatPhoneNumber_0200
- * @tc.desc PhoneNumber is 13900000000, options: CN, test formatPhoneNumber() api by callback.
- * The return value is 139 0000 0000
- */
- it('Telephony_CallManager_formatPhoneNumber_Async_0200', 0, async function (done) {
- let numberFormatOptions = new NumberFormatOptions('CN');
- call.formatPhoneNumber('13900000000', numberFormatOptions, (err, data) => {
- if (err) {
- console.log(`Telephony_CallManager_formatPhoneNumber_Async_0200 err = ${err.message}`);
- console.log('Telephony_CallManager_formatPhoneNumber_Async_0200 fail');
- expect().assertFail();
- done();
- return;
- }
- expect(data === '139 0000 0000').assertTrue();
- console.log(`Telephony_CallManager_formatPhoneNumber_Async_0200 finish data = ${data}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0300
- * @tc.name testFormatPhoneNumber_0300
- * @tc.desc PhoneNumber is 13900000000, options: US, test formatPhoneNumber() api by promise.
- * The return value is '1 390-000-0000'
- */
- it('Telephony_CallManager_formatPhoneNumber_Promise_0200', 0, async function (done) {
- let numberFormatOptions = new NumberFormatOptions('US');
- try {
- var data = await call.formatPhoneNumber('13900000000', numberFormatOptions);
- expect(data === '1 390-000-0000').assertTrue();
- console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0200 finish data = ${data}`);
- done();
- } catch (err) {
- console.log('Telephony_CallManager_formatPhoneNumber_Promise_0200 fail');
- expect().assertFail();
- done();
- }
- });
-
- /**
- * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0100
- * @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumberToE164() to format the number,
- * and return +861000000000
- * @tc.desc Function test
- */
- it('Telephony_CallManager_formatPhoneNumberToE164_Async_0100', 0, async function (done) {
- let numberFormatOptions = new NumberFormatOptions('CN');
- call.formatPhoneNumberToE164('010-0000-0000', numberFormatOptions.countryCode, (err, data) => {
- if (err) {
- console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0100 fail');
- expect().assertFail();
- done();
- return;
- }
- expect(data === '+861000000000').assertTrue();
- console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0100 finish data = ${data}`);
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0100
- * @tc.name PhoneNumber is 52300000000, options: CN, call formatPhoneNumberToE164() to format the number,
- * return +8652300000000
- * @tc.desc Function test
- */
- it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100', 0, async function (done) {
- let numberFormatOptions = new NumberFormatOptions('CN');
- try {
- var data = await call.formatPhoneNumberToE164('52300000000', numberFormatOptions.countryCode);
- expect(data === '+8652300000000').assertTrue();
- console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 finish data = ${data}`);
- done();
- } catch (err) {
- console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 fail');
- expect().assertFail();
- done();
-
- }
- });
-
- /**
- * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1300
- * @tc.name PhoneNumber: 110, options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency
- * number. The return value is false
- * @tc.desc Function test
- */
- it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300', 0, async function (done) {
- let emergencyNumberOptions = new EmergencyNumberOptions(ERR_SLOT_ID);
- call.isEmergencyPhoneNumber('110', emergencyNumberOptions, (err) => {
- if (err) {
- console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 finish err = ${err}`);
- done();
- return;
- }
- expect().assertFail();
- console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 fail ');
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300
- * @tc.name PhoneNumber: 120, options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency
- * number. The return value is false
- * @tc.desc Function test
- */
- it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300', 0, async function (done) {
- let emergencyNumberOptions = new EmergencyNumberOptions(ERR_SLOT_ID);
- try {
- var data = await call.isEmergencyPhoneNumber('120', emergencyNumberOptions);
- expect().assertFail();
- console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail ');
- done();
- } catch (err) {
- console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 finish err = ${err}`);
- done();
- }
- });
-
- /**
- * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1400
- * @tc.name testIsEmergencyPhoneNumber_1400
- * @tc.desc PhoneNumber: 110, no options. Call isEmergencyPhoneNumber() api by callback.
- * The return value is true
- */
- it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1400', 0, async function (done) {
- call.isEmergencyPhoneNumber('110', (err) => {
- if (err) {
- console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 finish err = ${err}`);
- expect().assertFail();
- done();
- return;
- }
- expect(true).assertTrue();
- console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 PASSED ');
- done();
- });
- });
-
- /**
- * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1500
- * @tc.name testIsEmergencyPhoneNumber_1500
- * @tc.desc PhoneNumber: 120, no options. Call isEmergencyPhoneNumber() api by promise.
- * The return value is true
- */
- it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400', 0, async function (done) {
- try {
- var data = await call.isEmergencyPhoneNumber('120');
- expect(true).assertTrue();
- console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 PASSED ');
- done();
- } catch (err) {
- console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 finish err = ${err}`);
- expect().assertFail();
- done();
- }
- });
-});
\ 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 call from '@ohos.telephony.call';
+import observer from '@ohos.telephony.observer';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+import {
+ AUTO_ACCEPT_NUMBER,
+ AUTO_ACCEPT_NUMBER2,
+ PHONE_NUMBER_LENGTH_11,
+ CALL_STATUS_DIALING,
+ CALL_ID_NOT_EXIST,
+ CALL_STATE_UNKNOWN,
+ CALL_STATE_IDLE,
+ DEFAULT_SLOT_ID,
+ CALL_MODE_IMS,
+ SLOT_ID_INVALID,
+ PHONE_LIST2,
+ RTT_MSG,
+ CALL_MODE_SEND_RECEIVE,
+ POS_700,
+ POS_10,
+ POS_LENGTH_300,
+ POS_LENGTH_600,
+ DEVICE_EARPIECE,
+ BOUNDARY_NUMBER_INT,
+ SENT_STRING_C,
+ MINUS_VALUE,
+ PHONE_NUMBER_LONG,
+ NULL_PHONE_NUMBER,
+ DIAL_CARRIER_TYPE,
+ DIAL_SCENCE_CALL_PRIVILEGED,
+ MEDIA_TYPE_VOICE,
+ ROTATION_MINUS_1,
+ IMAGE_LOCAL_ERROR_PATH,
+ POS_Z_ERROR,
+ RESTRICTION_TYPE_ROAMING_INCOMING,
+ RESTRICTION_MODE_ACTIVATION,
+ RIGHT_PASSWORD,
+ RESTRICTION_TYPE_ALL_INCOMING,
+ TRANSFER_TYPE_NOT_REACHABLE,
+ TRANSFER_TYPE_UNCONDITIONAL,
+ PHONE_NUMBER_AREA_LAND,
+ CALL_TRANSFER_DISABLE,
+ TRANSFER_TYPE_NO_REPLY,
+ COMMAND_CALL_ERROR4,
+ COMMAND_CALL_ERROR,
+ CARMER_ID_NOT_EXIT,
+ ZOOM_RATIO_MINUS_1_0,
+ DIAL_SCENCE_CALL_NORMAL,
+ DIAL_TYPE_OTT,
+ EVENT_OTT_FUNCTION_UNSUPPORTED,
+ TEL_CONFERENCE_IDLE
+} from './lib/Const.js';
+import {toString} from './lib/ApiToPromise.js';
+import {
+ scenceInCalling,
+ hangupCall2,
+ hangupCall,
+ callDetailsChangeOn,
+ callId as gloabCallId,
+ reachState,
+ callDetailsChangeOff,
+ reachCallEventState
+} from './lib/ScenceInCalling.js';
+const GETMAIN_CALLID_ERRO = -1;
+const REJECT_MESSAGE_STR = 'Hi,hello?';
+const REJECT_MESSAGE_NUM = 1234567890123456789012345678901234567890;
+const ERR_SLOT_ID = -1;
+const SLOTID = 0;
+const THE_THREE_NUMBER = '112';
+const DIAL_TYPE_ERR_CALL = 3;
+const TIME_OUT = 20000;
+const WAITING_TIME = 200;
+
+let callId = null;
+class RejectMessageOptions {
+ constructor (str) {
+ this.messageContent = str;
+ }
+}
+class EmergencyNumberOptions {
+ constructor (num) {
+ this.slotId = num;
+ }
+}
+class NumberFormatOptions {
+ constructor (str) {
+ this.countryCode = str;
+ }
+}
+class CallAttributeOptions {
+ constructor (accountNumber, speakerphoneOn, accountId, videoState, startTime,
+ isEcc, callType, callId, callState, conferenceState) {
+ this.accountNumber = accountNumber;
+ this.speakerphoneOn = speakerphoneOn;
+ this.accountId = accountId;
+ this.videoState = videoState;
+ this.startTime = startTime;
+ this.isEcc = isEcc;
+ this.callType = callType;
+ this.callId = callId;
+ this.callState = callState;
+ this.conferenceState = conferenceState;
+ }
+}
+
+const sleep = (time) => {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve();
+ }, time);
+ });
+};
+
+var callState = -1;
+var timing = 0;
+var endTime = 0;
+export default function CallManageImsCall() {
+describe('CallManageImsCall', function () {
+ beforeAll(async function (done) {
+ try {
+ console.log('Telephony_CallManager enableImsSwitch success');
+ await call.setCallPreferenceMode(DEFAULT_SLOT_ID, CALL_MODE_IMS);
+ console.log('Telephony_CallManager setCallPreferenceMode success');
+ } catch (error) {
+ console.log(`Telephony_CallManager setCallPreferenceMode or enableImsSwitch error,error:${toString(error)}`);
+ }
+ done();
+ });
+
+ afterEach(async function () {
+ try {
+ const CURRENT_TIME = new Date().valueOf();
+ const TEMP_CALL_ID = 10;
+ const IS_ECC = true;
+ const SPEAK_ON = true;
+ let callAttributeOptions = new CallAttributeOptions(AUTO_ACCEPT_NUMBER, SPEAK_ON, DEFAULT_SLOT_ID,
+ MEDIA_TYPE_VOICE, CURRENT_TIME, IS_ECC, DIAL_TYPE_OTT, TEMP_CALL_ID, CALL_STATUS_DIALING,
+ TEL_CONFERENCE_IDLE);
+ console.log(`Telephony_CallManager ${toString(callAttributeOptions)}`);
+ expect(callAttributeOptions.accountNumber === AUTO_ACCEPT_NUMBER).assertTrue();
+ expect(callAttributeOptions.speakerphoneOn === SPEAK_ON).assertTrue();
+ expect(callAttributeOptions.accountId === DEFAULT_SLOT_ID).assertTrue();
+ expect(callAttributeOptions.videoState === MEDIA_TYPE_VOICE).assertTrue();
+ expect(callAttributeOptions.startTime === CURRENT_TIME).assertTrue();
+ expect(callAttributeOptions.isEcc === IS_ECC).assertTrue();
+ expect(callAttributeOptions.callType === DIAL_TYPE_OTT).assertTrue();
+ expect(callAttributeOptions.callId === TEMP_CALL_ID).assertTrue();
+ expect(callAttributeOptions.callState === CALL_STATUS_DIALING).assertTrue();
+ expect(callAttributeOptions.conferenceState === TEL_CONFERENCE_IDLE).assertTrue();
+ } catch (error) {
+ console.log(`Telephony_CallManager ${toString(error)}`);
+ }
+ try {
+ let callState = await call.getCallState();
+ console.log(`Telephony_CallManager callState ${callState} ${gloabCallId}`);
+ if (callState === CALL_STATE_UNKNOWN || callState === CALL_STATE_IDLE) {
+ return;
+ }
+ if (gloabCallId) {
+ let data = await hangupCall('Telephony_CallManager', gloabCallId);
+ console.log(`Telephony_CallManager hangupCall success ${toString(data)}`);
+ }
+ } catch (error) {
+ console.log('Telephony_CallManager hangupCall or getCallState error');
+ }
+ });
+
+ afterAll(function () {
+ observer.off('callStateChange');
+ callDetailsChangeOff();
+ console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall');
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400
+ * @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID,
+ * by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_enableLteEnhanceMode_Async_0400';
+ call.enableLteEnhanceMode(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} enableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} enableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400
+ * @tc.name Run the function enableLteEnhanceMode by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_enableLteEnhanceMode_Promise_0400';
+ call.enableLteEnhanceMode(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} enableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} enableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400
+ * @tc.name Run the function disableLteEnhanceMode by args slotId SLOT_ID_INVALID,
+ * by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_disableLteEnhanceMode_Async_0400';
+ call.disableLteEnhanceMode(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} disableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} disableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400
+ * @tc.name Run the function disableLteEnhanceMode by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_disableLteEnhanceMode_Promise_0400';
+ call.disableLteEnhanceMode(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} disableLteEnhanceMode success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} disableLteEnhanceMode error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400
+ * @tc.name Run the function isLteEnhanceModeEnabled by args slotId SLOT_ID_INVALID by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Async_0400';
+ call.isLteEnhanceModeEnabled(SLOT_ID_INVALID, (error, data) => {
+ if (error) {
+ console.log(`${caseName} isLteEnhanceModeEnabled error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} isLteEnhanceModeEnabled success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400
+ * @tc.name Run the function isLteEnhanceModeEnabled by args slotId SLOT_ID_INVALID by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_isLteEnhanceModeEnabled_Promise_0400';
+ call.isLteEnhanceModeEnabled(SLOT_ID_INVALID).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} isLteEnhanceModeEnabled success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} isLteEnhanceModeEnabled error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_startRTT_Async_0200
+ * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_startRTT_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_startRTT_Async_0200';
+ call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG, (error, data) => {
+ if (error) {
+ console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_startRTT_Promise_0200
+ * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_startRTT_Promise_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_startRTT_Promise_0200';
+ call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_stopRTT_Async_0200
+ * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_stopRTT_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_stopRTT_Async_0200';
+ call.stopRTT(CALL_ID_NOT_EXIST, (error, data) => {
+ if (error) {
+ console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_IMS_stopRTT_Promise_0200
+ * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_IMS_stopRTT_Promise_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_IMS_stopRTT_Promise_0200';
+ call.stopRTT(CALL_ID_NOT_EXIST).then(data => {
+ expect().assertFail();
+ console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`);
+ done();
+ }).catch(error => {
+ console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`);
+ done();
+ });
+ });
+
+
+ /**
+ * @tc.number Telephony_CallManager_controlCamera_Async_0200
+ * @tc.name Dial a call and after answering the call,run function controlCamera by
+ * args cameraId CARMER_ID_NOT_EXIT by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_controlCamera_Async_0200', 0, function (done) {
+ let caseName = 'Telephony_CallManager_controlCamera_Async_0200';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ let cameraId = CARMER_ID_NOT_EXIT;
+ call.controlCamera(cameraId, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_controlCamera_Promise_0200
+ * @tc.name Dial a call and after answering the call,run function controlCamera by args cameraId
+ * CARMER_ID_NOT_EXIT by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_controlCamera_Promise_0200', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_controlCamera_Promise_0200';
+ let cameraId = CARMER_ID_NOT_EXIT;
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.controlCamera(cameraId);
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ } catch (err) {
+ console.log(`${caseName} case success. error:${toString(err)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPreviewWindow_Async_0300
+ * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPreviewWindow_Async_0300', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setPreviewWindow_Async_0300';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ call.setPreviewWindow(info, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPreviewWindow_Promise_0300
+ * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPreviewWindow_Promise_0300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setPreviewWindow_Promise_0300';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ await call.setPreviewWindow(info);
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDisplayWindow_Async_0300
+ * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDisplayWindow_Async_0300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setDisplayWindow_Async_0300';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ await call.setDisplayWindow(info);
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDisplayWindow_Promise_0300
+ * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args
+ * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise,
+ * the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600};
+ await call.setDisplayWindow(info);
+ console.log(`${caseName} case faild`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setCameraZoom_Async_0400
+ * @tc.name Dial a call and after answering the call,run function setCameraZoom by args
+ * zoomRatio ZOOM_RATIO_MINUS_1_0 by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.setCameraZoom(ZOOM_RATIO_MINUS_1_0, (error) => {
+ if (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setCameraZoom_Promise_0400
+ * @tc.name Dial a call and after answering the call,run function setCameraZoom by args
+ * zoomRatio ZOOM_RATIO_MINUS_1_0 by promise,the function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setCameraZoom_Promise_0400', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setCameraZoom_Promise_0400';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.setCameraZoom(ZOOM_RATIO_MINUS_1_0);
+ console.log(`${caseName} case failed`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} error,case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPausePicture_Async_0500
+ * @tc.name Dial a call and after answering the call,run function setPausePicture by args
+ * path IMAGE_LOCAL_ERROR_PATH by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPausePicture_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setPausePicture_Async_0500';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.setPausePicture(IMAGE_LOCAL_ERROR_PATH, (error) => {
+ if (error) {
+ console.log(`${caseName} case success,error:${toString(error)}`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} success,case failed`);
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setPausePicture_Promise_0500
+ * @tc.name Dial a call and after answering the call,run function setPausePicture
+ * by args path IMAGE_LOCAL_ERROR_PATH by promise,
+ * the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setPausePicture_Promise_0500', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setPausePicture_Promise_0500';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.setPausePicture(IMAGE_LOCAL_ERROR_PATH);
+ console.log(`${caseName} success,case failed`);
+ } catch (error) {
+ console.log(`${caseName} case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDeviceDirection_Async_0500
+ * @tc.name Dial a call and after answering the call,run function setDeviceDirection
+ * by args rotation ROTATION_MINUS_1 by callback,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDeviceDirection_Async_0500', 0, function (done) {
+ let caseName = 'Telephony_CallManager_setDeviceDirection_Async_0500';
+ scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER,
+ checkState:CALL_STATUS_DIALING
+ }).then(data => {
+ callId = data.callId;
+ call.setDeviceDirection(ROTATION_MINUS_1, (error) => {
+ if (error) {
+ console.log(`${caseName} success, case success`);
+ hangupCall2(caseName, done, callId);
+ return;
+ }
+ console.log(`${caseName} error,case failed,error:${toString(error)}`);
+ expect().assertFail();
+ hangupCall2(caseName, done, callId);
+ });
+ }).catch(error => {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_setDeviceDirection_Promise_0500
+ * @tc.name Dial a call and after answering the call,run function setDeviceDirection
+ * by args rotation ROTATION_MINUS_1 by promise,the callback function return error
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_setDeviceDirection_Promise_0500', 0, async function (done) {
+ let caseName = 'Telephony_CallManager_setDeviceDirection_Promise_0500';
+ try {
+ let data = await scenceInCalling({
+ caseName:caseName,
+ phoneNumber:AUTO_ACCEPT_NUMBER2,
+ checkState:CALL_STATUS_DIALING
+ });
+ callId = data.callId;
+ } catch (error) {
+ console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`);
+ done();
+ return;
+ }
+ try {
+ await call.setDeviceDirection(ROTATION_MINUS_1);
+ console.log(`${caseName} success,case error`);
+ expect().assertFail();
+ } catch (error) {
+ console.log(`${caseName} case success,error:${toString(error)}`);
+ }
+ hangupCall2(caseName, done, callId);
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getCallState_Async_0100
+ * @tc.name To get the idle call status, call getCallState() to get the current call status.
+ * call.CALL_STATE_IDLE is returned
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getCallState_Async_0100', 0, async function (done) {
+ call.getCallState((err, data) => {
+ if (err) {
+ console.log(`Telephony_CallManager_getCallState_Async_0100 : err = ${err.message}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data == call.CALL_STATE_IDLE ||
+ data == call.CALL_STATE_UNKNOWN ||
+ data == call.CALL_STATE_RINGING ||
+ data == call.CALL_STATE_OFFHOOK).assertTrue();
+ console.log(`Telephony_CallManager_getCallState_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_getCallState_Promise_0100
+ * @tc.name To get the idle call status, call getCallState() to get the current call status.
+ * call.CALL_STATE_IDLE is returned
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_getCallState_Promise_0100', 0, async function (done) {
+ try {
+ var data = await call.getCallState();
+ expect(data == call.CALL_STATE_IDLE ||
+ data == call.CALL_STATE_UNKNOWN ||
+ data == call.CALL_STATE_RINGING ||
+ data == call.CALL_STATE_OFFHOOK).assertTrue();
+ console.log(`Telephony_CallManager_getCallState_Promise_0100 finish data = ${data}`);
+ done();
+ } catch (err) {
+ console.log(`Telephony_CallManager_getCallState_Promise_0100 : err = ${err.message}`);
+ expect().assertFail();
+ done();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_hasCall_Async_0400
+ * @tc.name When idle, hasCall() is called to confirm that there is no current call,returning false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_hasCall_Async_0400', 0, async function (done) {
+ call.hasCall((err, data) => {
+ if (err) {
+ console.log('Telephony_CallManager_hasCall_Async_0400 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ console.log(`Telephony_CallManager_hasCall_Async_0400 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_hasCall_Promise_0400
+ * @tc.name When idle, hasCall() is called to confirm that there is no current call, returning false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_hasCall_Promise_0400', 0, async function (done) {
+ try {
+ var data = await call.hasCall();
+ console.log(`Telephony_CallManager_hasCall_Promise_0400 finish data = ${data}`);
+ done();
+ } catch (err) {
+ console.log('Telephony_CallManager_hasCall_Promise_0400 fail');
+ expect().assertFail();
+ done();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0100
+ * @tc.name PhoneNumber is 100000000000. Call formatPhoneNumber() to format the number.
+ * The return value is 10 000 000 0000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumber_Async_0100', 0, async function (done) {
+ call.formatPhoneNumber('100000000000', (err, data) => {
+ if (err) {
+ console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 err = ${err.message}`);
+ console.log('Telephony_CallManager_formatPhoneNumber_Async_0100 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data === '10 000 000 0000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0100
+ * @tc.name PhoneNumber is 2000000. Call formatPhoneNumber() to format the number.
+ * The return value is 200 0000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumber_Promise_0100', 0, async function (done) {
+ try {
+ var data = await call.formatPhoneNumber('2000000');
+ expect(data === '200 0000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0100 finish data = ${data}`);
+ done();
+ } catch (err) {
+ console.log('Telephony_CallManager_formatPhoneNumber_Promise_0100 fail');
+ expect().assertFail();
+ done();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0200
+ * @tc.name testFormatPhoneNumber_0200
+ * @tc.desc PhoneNumber is 13900000000, options: CN, test formatPhoneNumber() api by callback.
+ * The return value is 139 0000 0000
+ */
+ it('Telephony_CallManager_formatPhoneNumber_Async_0200', 0, async function (done) {
+ let numberFormatOptions = new NumberFormatOptions('CN');
+ call.formatPhoneNumber('13900000000', numberFormatOptions, (err, data) => {
+ if (err) {
+ console.log(`Telephony_CallManager_formatPhoneNumber_Async_0200 err = ${err.message}`);
+ console.log('Telephony_CallManager_formatPhoneNumber_Async_0200 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data === '139 0000 0000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumber_Async_0200 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0300
+ * @tc.name testFormatPhoneNumber_0300
+ * @tc.desc PhoneNumber is 13900000000, options: US, test formatPhoneNumber() api by promise.
+ * The return value is '1 390-000-0000'
+ */
+ it('Telephony_CallManager_formatPhoneNumber_Promise_0200', 0, async function (done) {
+ let numberFormatOptions = new NumberFormatOptions('US');
+ try {
+ var data = await call.formatPhoneNumber('13900000000', numberFormatOptions);
+ expect(data === '1 390-000-0000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0200 finish data = ${data}`);
+ done();
+ } catch (err) {
+ console.log('Telephony_CallManager_formatPhoneNumber_Promise_0200 fail');
+ expect().assertFail();
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0100
+ * @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumberToE164() to format the number,
+ * and return +861000000000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumberToE164_Async_0100', 0, async function (done) {
+ let numberFormatOptions = new NumberFormatOptions('CN');
+ call.formatPhoneNumberToE164('010-0000-0000', numberFormatOptions.countryCode, (err, data) => {
+ if (err) {
+ console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0100 fail');
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(data === '+861000000000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0100 finish data = ${data}`);
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0100
+ * @tc.name PhoneNumber is 52300000000, options: CN, call formatPhoneNumberToE164() to format the number,
+ * return +8652300000000
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100', 0, async function (done) {
+ let numberFormatOptions = new NumberFormatOptions('CN');
+ try {
+ var data = await call.formatPhoneNumberToE164('52300000000', numberFormatOptions.countryCode);
+ expect(data === '+8652300000000').assertTrue();
+ console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 finish data = ${data}`);
+ done();
+ } catch (err) {
+ console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 fail');
+ expect().assertFail();
+ done();
+
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1300
+ * @tc.name PhoneNumber: 110, options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency
+ * number. The return value is false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300', 0, async function (done) {
+ let emergencyNumberOptions = new EmergencyNumberOptions(ERR_SLOT_ID);
+ call.isEmergencyPhoneNumber('110', emergencyNumberOptions, (err) => {
+ if (err) {
+ console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 finish err = ${err}`);
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 fail ');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300
+ * @tc.name PhoneNumber: 120, options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency
+ * number. The return value is false
+ * @tc.desc Function test
+ */
+ it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300', 0, async function (done) {
+ let emergencyNumberOptions = new EmergencyNumberOptions(ERR_SLOT_ID);
+ try {
+ var data = await call.isEmergencyPhoneNumber('120', emergencyNumberOptions);
+ expect().assertFail();
+ console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail ');
+ done();
+ } catch (err) {
+ console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 finish err = ${err}`);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1400
+ * @tc.name testIsEmergencyPhoneNumber_1400
+ * @tc.desc PhoneNumber: 110, no options. Call isEmergencyPhoneNumber() api by callback.
+ * The return value is true
+ */
+ it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1400', 0, async function (done) {
+ call.isEmergencyPhoneNumber('110', (err) => {
+ if (err) {
+ console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 finish err = ${err}`);
+ expect().assertFail();
+ done();
+ return;
+ }
+ expect(true).assertTrue();
+ console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 PASSED ');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1500
+ * @tc.name testIsEmergencyPhoneNumber_1500
+ * @tc.desc PhoneNumber: 120, no options. Call isEmergencyPhoneNumber() api by promise.
+ * The return value is true
+ */
+ it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400', 0, async function (done) {
+ try {
+ var data = await call.isEmergencyPhoneNumber('120');
+ expect(true).assertTrue();
+ console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 PASSED ');
+ done();
+ } catch (err) {
+ console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 finish err = ${err}`);
+ expect().assertFail();
+ done();
+ }
+ });
+});
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/List.test.js
similarity index 81%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/List.test.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/List.test.js
index f4aa98ba23b41a34c9a959aeee40f5992019d6c0..549a4b4de1438406e775166cc0a79cea2c63d728 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/List.test.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/List.test.js
@@ -1,15 +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('./CallManageAll.test.js');
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import CallManageImsCall from './CallManageAll.test.js'
+
+export default function testsuite() {
+ CallManageImsCall()
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromise.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromise.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromise.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromise.js
index 6b600564fdbb1d4d60842af99ba7e91d0af346ca..10981333ad37abc2c524268c2650624a463f7f5f 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromise.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromise.js
@@ -1,40 +1,40 @@
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export function toString (data) {
- if (typeof data === 'object') {
- return JSON.stringify(data);
- } else {
- return data;
- }
-}
-
-export function promisify (fn) {
- return function () {
- let args = Array.prototype.slice.call(arguments);
- return new Promise(function (resolve, reject) {
- console.log(`Telephony_CallManager promisify args:${toString(arguments)},fn:${fn}`);
- args.push(function (error, data) {
- console.log(`Telephony_CallManager promisify error:${toString(error)},data:${toString(data)}`);
- if (error) {
- reject(error);
- } else {
- resolve(data);
- }
- });
- fn.apply(null, args);
- });
- };
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 function toString (data) {
+ if (typeof data === 'object') {
+ return JSON.stringify(data);
+ } else {
+ return data;
+ }
+}
+
+export function promisify (fn) {
+ return function () {
+ let args = Array.prototype.slice.call(arguments);
+ return new Promise(function (resolve, reject) {
+ console.log(`Telephony_CallManager promisify args:${toString(arguments)},fn:${fn}`);
+ args.push(function (error, data) {
+ console.log(`Telephony_CallManager promisify error:${toString(error)},data:${toString(data)}`);
+ if (error) {
+ reject(error);
+ } else {
+ resolve(data);
+ }
+ });
+ fn.apply(null, args);
+ });
+ };
}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromisePerfomance.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromisePerfomance.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromisePerfomance.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromisePerfomance.js
index 5a56f755682cf2a3044420b18f85f3071d3475f5..09c3181dede19d977d553d71716d6158712a81a9 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromisePerfomance.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromisePerfomance.js
@@ -1,139 +1,139 @@
-
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {TEST_PERF_COUNT, PERF_GOAL_TIME} from './Const.js';
-import {toString} from './ApiToPromise.js';
-// packaging the function to the perfomace test function
-export async function apiToPromisePerfomace (options, args) {
- // recursion plan
- let {func, caseName, target, perfTime, compareFunc} = options;
- let flag = true;
- let count = TEST_PERF_COUNT;
- perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
-
- console.log(`${caseName} apiToPromisePerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
- function excuteCallbackPromise () {
- return new Promise((resolve, reject) => {
- function excuteCallback () {
- target[func](...args);
- }
- args[args.length - 1] = function (error, data) {
- if (count === 0) {
- if (flag) {
- resolve(flag);
- } else {
- reject(new Error(`flag:${flag}`));
- }
- } else {
- flag = flag && !!compareFunc(error, data);
- count--;
- excuteCallback();
- }
- };
- excuteCallback();
- });
- }
-
- let startTime = new Date().getTime();
- if (typeof args[args.length - 1] === 'function') {
- try {
- flag = await excuteCallbackPromise();
- } catch (error) {
- flag = false;
- }
- } else {
- for (;count > 0;count--) {
- let error = null;
- let data = null;
- try {
- data = await target[func](...args);
- flag = flag && !!compareFunc(error, data);
- } catch (err) {
- error = err;
- flag = flag && !!compareFunc(error, data);
- }
- }
- }
- let endTime = new Date().getTime();
- const cost = endTime - startTime;
- console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
- ` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
- if (flag && cost < perfTime) {
- return flag;
- } else {
- throw new Error(`flag:${flag}`);
- }
-}
-
-export async function apiToPerfomace (options, args) {
- // recursion plan
- let {func, caseName, target, perfTime, compareFunc, runedFunc} = options;
- let flag = true;
- let count = TEST_PERF_COUNT;
- perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
-
- console.log(`${caseName} apiToPerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
- function excuteCallbackPromise () {
- return new Promise((resolve, reject) => {
- function excuteCallback () {
- target[func](...args);
- }
- args[args.length - 1] = function (error, data) {
- if (count === 0) {
- if (flag) {
- resolve(flag);
- } else {
- reject(new Error(`flag:${flag}`));
- }
- } else {
- flag = flag && !!compareFunc(error, data);
- count--;
- excuteCallback();
- }
- };
- excuteCallback();
- });
- }
-
- let startTime = new Date().getTime();
- if (typeof args[args.length - 1] === 'function') {
- try {
- flag = await excuteCallbackPromise();
- } catch (error) {
- flag = false;
- }
- } else {
- for (;count > 0;count--) {
- let error = null;
- let data = null;
- try {
- data = await target[func](...args);
- flag = flag && !!compareFunc(error, data);
- } catch (err) {
- error = err;
- flag = flag && !!compareFunc(error, data);
- }
- }
- }
- let endTime = new Date().getTime();
- const cost = endTime - startTime;
- console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
- ` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
- runedFunc(flag && cost < perfTime);
-}
-export function validate (error, data, func) {
- return func(error, data);
+
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {TEST_PERF_COUNT, PERF_GOAL_TIME} from './Const.js';
+import {toString} from './ApiToPromise.js';
+// packaging the function to the perfomace test function
+export async function apiToPromisePerfomace (options, args) {
+ // recursion plan
+ let {func, caseName, target, perfTime, compareFunc} = options;
+ let flag = true;
+ let count = TEST_PERF_COUNT;
+ perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
+
+ console.log(`${caseName} apiToPromisePerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ let startTime = new Date().getTime();
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ }
+ }
+ let endTime = new Date().getTime();
+ const cost = endTime - startTime;
+ console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
+ ` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
+ if (flag && cost < perfTime) {
+ return flag;
+ } else {
+ throw new Error(`flag:${flag}`);
+ }
+}
+
+export async function apiToPerfomace (options, args) {
+ // recursion plan
+ let {func, caseName, target, perfTime, compareFunc, runedFunc} = options;
+ let flag = true;
+ let count = TEST_PERF_COUNT;
+ perfTime = perfTime ? perfTime : PERF_GOAL_TIME;
+
+ console.log(`${caseName} apiToPerfomace func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ let startTime = new Date().getTime();
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ }
+ }
+ let endTime = new Date().getTime();
+ const cost = endTime - startTime;
+ console.log(`${caseName} ${func} result flag:${toString(flag)} count:${TEST_PERF_COUNT}` +
+ ` cost:${cost}ms avarage:${parseInt(cost * 1000 / TEST_PERF_COUNT)}`);
+ runedFunc(flag && cost < perfTime);
+}
+export function validate (error, data, func) {
+ return func(error, data);
}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromiseReliability.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromiseReliability.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromiseReliability.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromiseReliability.js
index c38a591c24b8095ef98bcaf7e73d831f3f77d21f..3a65a85202e993511ea50b57e306977c1ba6c2cb 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ApiToPromiseReliability.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ApiToPromiseReliability.js
@@ -1,131 +1,131 @@
-/**
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {toString} from './ApiToPromise.js';
-import {TEST_RELY_NUMBER} from './Const.js';
-// packaging the function to the reliability test function
-export async function apiToPromiseReliability (options, args) {
- // recursion plan
- let {func, caseName, target, compareFunc} = options;
- let flag = true;
- let count = TEST_RELY_NUMBER;
-
- console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
- function excuteCallbackPromise () {
- return new Promise((resolve, reject) => {
- function excuteCallback () {
- target[func](...args);
- }
- args[args.length - 1] = function (error, data) {
- if (count === 0) {
- if (flag) {
- resolve(flag);
- } else {
- reject(new Error(`flag:${flag}`));
- }
- } else {
- flag = flag && !!compareFunc(error, data);
- count--;
- excuteCallback();
- }
- };
- excuteCallback();
- });
- }
-
- if (typeof args[args.length - 1] === 'function') {
- try {
- flag = await excuteCallbackPromise();
- } catch (error) {
- flag = false;
- }
- } else {
- for (;count > 0;count--) {
- let error = null;
- let data = null;
- try {
- data = await target[func](...args);
- flag = flag && !!compareFunc(error, data);
- } catch (err) {
- error = err;
- flag = flag && !!compareFunc(error, data);
- }
- }
- }
- console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
- if (flag) {
- return flag;
- } else {
- throw new Error(`flag:${flag}`);
- }
-}
-
-export async function apiToReliability (options, args) {
- // recursion plan
- let {func, caseName, target, compareFunc, runedFunc} = options;
- let flag = true;
- let count = TEST_RELY_NUMBER;
-
- console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
- function excuteCallbackPromise () {
- return new Promise((resolve, reject) => {
- function excuteCallback () {
- target[func](...args);
- }
- args[args.length - 1] = function (error, data) {
- console.log(`${caseName} error ${toString(error)} data ${toString(data)}`);
- if (count === 0) {
- if (flag) {
- resolve(flag);
- } else {
- reject(new Error(`flag:${flag}`));
- }
- } else {
- flag = flag && !!compareFunc(error, data);
- count--;
- console.log(`${caseName} error:${toString(error)},data:${toString(data)},` +
- `flag:${flag},count:${count}`);
- excuteCallback();
- }
- };
- excuteCallback();
- });
- }
-
- if (typeof args[args.length - 1] === 'function') {
- try {
- flag = await excuteCallbackPromise();
- } catch (error) {
- flag = false;
- }
- } else {
- for (;count > 0;count--) {
- let error = null;
- let data = null;
- try {
- data = await target[func](...args);
- flag = flag && !!compareFunc(error, data);
- } catch (err) {
- error = err;
- flag = flag && !!compareFunc(error, data);
- }
- console.log(`${caseName} error:${toString(error)},data:${toString(data)},flag:${flag},count:${count}`);
- }
- }
- console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
- runedFunc(flag);
-}
-
-
+/**
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {toString} from './ApiToPromise.js';
+import {TEST_RELY_NUMBER} from './Const.js';
+// packaging the function to the reliability test function
+export async function apiToPromiseReliability (options, args) {
+ // recursion plan
+ let {func, caseName, target, compareFunc} = options;
+ let flag = true;
+ let count = TEST_RELY_NUMBER;
+
+ console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ }
+ }
+ console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
+ if (flag) {
+ return flag;
+ } else {
+ throw new Error(`flag:${flag}`);
+ }
+}
+
+export async function apiToReliability (options, args) {
+ // recursion plan
+ let {func, caseName, target, compareFunc, runedFunc} = options;
+ let flag = true;
+ let count = TEST_RELY_NUMBER;
+
+ console.log(`${caseName} apiToPromiseReliability func ${func}, caseName ${caseName},args:${toString(args)}`);
+ function excuteCallbackPromise () {
+ return new Promise((resolve, reject) => {
+ function excuteCallback () {
+ target[func](...args);
+ }
+ args[args.length - 1] = function (error, data) {
+ console.log(`${caseName} error ${toString(error)} data ${toString(data)}`);
+ if (count === 0) {
+ if (flag) {
+ resolve(flag);
+ } else {
+ reject(new Error(`flag:${flag}`));
+ }
+ } else {
+ flag = flag && !!compareFunc(error, data);
+ count--;
+ console.log(`${caseName} error:${toString(error)},data:${toString(data)},` +
+ `flag:${flag},count:${count}`);
+ excuteCallback();
+ }
+ };
+ excuteCallback();
+ });
+ }
+
+ if (typeof args[args.length - 1] === 'function') {
+ try {
+ flag = await excuteCallbackPromise();
+ } catch (error) {
+ flag = false;
+ }
+ } else {
+ for (;count > 0;count--) {
+ let error = null;
+ let data = null;
+ try {
+ data = await target[func](...args);
+ flag = flag && !!compareFunc(error, data);
+ } catch (err) {
+ error = err;
+ flag = flag && !!compareFunc(error, data);
+ }
+ console.log(`${caseName} error:${toString(error)},data:${toString(data)},flag:${flag},count:${count}`);
+ }
+ }
+ console.log(`${caseName} result ${func} flag:${toString(flag)} count:${TEST_RELY_NUMBER}`);
+ runedFunc(flag);
+}
+
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/Const.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/Const.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/Const.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/Const.js
index b7d269010d8708ca53018e6187626e10cf705d4a..544249a449cb789f8cb7b49028e9b3fa26755392 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/Const.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/Const.js
@@ -1,228 +1,228 @@
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-export const AUTO_ACCEPT_NUMBER = '10010';
-export const AUTO_ACCEPT_NUMBER2 = '10010';
-export const PHONE_NUMBER_AREA_LAND = '089800000000';
-export const PHONE_NUMBER_LENGTH_8 = '86459751';
-
-export const PHONE_NUMBER_LENGTH_11 = '10000000001';
-export const PHONE_NUMBER_VOICE_MAIL = '12599';
-export const PHONE_NUMBER_LONG = '1234567890123456789012345678901234567890123' +
- '4567890123456789012345678901234567890123456789012345678901';
-export const EMERGENCY_NUMBER = '112';
-export const RIGHT_PASSWORD = '000001';
-export const ERROR_PASSWORD = '1234567890123456789012345678901234567890123' +
-'4567890123456789012345678901234567890123456789012345678901';
-export const CALL_EMERGENCY = 2;
-export const PHONE_LIST = ['10000000001'];
-export const PHONE_LIST2 = ['10000000001', '10000000002'];
-export const NULL_PHONE_NUMBER = '';
-export const SPECIA_CHAR_NUMBER = '"=#$%^&*()+';
-export const PHONE_NUMBER_CHAR = 'abcdefghijk';
-export const BOUNDARY_NUMBER_INT = 2147483649;
-export const MINUS_BOUNDARY_NUMBER_INT = -2147483649;
-export const MINUS_VALUE = -100;
-export const TEST_RELY_NUMBER = 20; // test count for Reliability
-export const TEST_PERF_COUNT = 20; // test count for Perfomace
-export const PERF_GOAL_TIME = TEST_PERF_COUNT * 0.5;
-
-export const CALL_STATUS_ACTIVE = 0;
-export const CALL_STATUS_HOLDING = 1;
-export const CALL_STATUS_DIALING = 2;
-export const CALL_STATUS_ALERTING = 3;
-export const CALL_STATUS_INCOMING = 4;
-export const CALL_STATUS_WAITING = 5;
-export const CALL_STATUS_DISCONNECTED = 6;
-export const CALL_STATUS_DISCONNECTING = 7;
-export const CALL_STATUS_IDLE = 8;
-
-export const TEL_CONFERENCE_IDLE = 0;
-export const TEL_CONFERENCE_ACTIVE = 1;
-export const TEL_CONFERENCE_DISCONNECTING = 2;
-export const TEL_CONFERENCE_DISCONNECTED = 3;
-
-export const DEVICE_EARPIECE = 0;
-export const DEVICE_SPEAKER = 1;
-export const DEVICE_WIRED_HEADSET = 2;
-export const DEVICE_BLUETOOTH_SCO = 3;
-export const DEVICE_INVALID = -1;
-export const DEVICE_INVALID4 = 4;
-
-export const RESTRICTION_MODE_DEACTIVATION = 0;
-export const RESTRICTION_MODE_ACTIVATION = 1;
-export const RESTRICTION_MODE_INVALID = -1;
-export const RESTRICTION_MODE_INVALID2 = 2;
-
-export const RESTRICTION_DISABLE = 0;
-export const RESTRICTION_ENABLE = 1;
-
-export const RESTRICTION_TYPE_ALL_INCOMING = 0;
-export const RESTRICTION_TYPE_ALL_OUTGOING = 1;
-export const RESTRICTION_TYPE_INTERNATIONAL = 2;
-export const RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME = 3;
-export const RESTRICTION_TYPE_ROAMING_INCOMING = 4;
-export const RESTRICTION_TYPE_INCOMING_SERVICES = 7;
-export const RESTRICTION_TYPE_OUTGOING_SERVICES = 6;
-export const RESTRICTION_TYPE_ALL_CALLS = 5;
-export const RESTRICTION_TYPE_INVALID = -1;
-export const RESTRICTION_TYPE_INVALID2 = 8;
-
-export const DEFAULT_SLOT_ID = 0;
-export const SLOT_ID1 = 1;
-export const SLOT_ID_INVALID = -1;
-export const SLOT_ID_INVALID_2 = 2;
-export const CALL_ID_NOT_EXIST = 999;
-export const VIDEO_STATE_AUDIO = 0;
-export const CALL_TYPE_CS = 0;
-export const CALL_TYPE_IMS = 1;
-
-export const EVENT_START_DTMF_SUCCESS = 3;
-export const EVENT_STOP_DTMF_SUCCESS = 5;
-
-export const CALL_STATE_UNKNOWN = -1;
-export const CALL_STATE_IDLE = 0;
-export const CALL_STATE_RINGING = 1;
-export const CALL_STATE_OFFHOOK = 2;
-
-export const TIMEOUT_LENTH = 1000;
-
-// call error code
-export const CALL_MANAGER_NUMBER_NULL_NOTICE = '83951616';
-
-export const TRANSFER_DISABLE = 0; // tran is close
-export const TRANSFER_ENABLE = 1; // tran is open
-
-export const CALL_TRANSFER_ENABLE = 0;
-export const CALL_TRANSFER_DISABLE = 1;
-export const CALL_TRANSFER_REGISTRATION = 3; // open tran function
-export const CALL_TRANSFER_ERASURE = 4; // close tran function
-export const CALL_TRANSFER_INVALID = -1;
-export const CALL_TRANSFER_INVALID2 = 5;
-export const CALL_TRANSFER_INVALID3 = 2;
-
-export const TRANSFER_TYPE_BUSY = 1; // tran busy
-export const TRANSFER_TYPE_NO_REPLY = 2;// no response tran
-export const TRANSFER_TYPE_NOT_REACHABLE = 3; // untouchable(no signal/shut down) tran
-export const TRANSFER_TYPE_UNCONDITIONAL = 0; // unconditional tran
-export const TRANSFER_TYPE_INVALID = -1;
-export const TRANSFER_TYPE_INVALID4 = 4;
-
-export const REACH_TIMES = 10;
-export const AFTER_HANUP_TIMES = 5;
-
-export const CARMER_ID_NOT_EXIT = 'xtsautotest123456';
-export const CARMER_ID_SPACE = '';
-export const IMAGE_PNG_PATH = '/system/data/callManager.png';
-export const IMAGE_JPG_PATH = '/system/data/callManager.jpg';
-export const IMAGE_BMP_PATH = '/system/data/callManager.bmp';
-export const IMAGE_WEBP_PATH = '/system/data/callManager.webp';
-export const IMAGE_LOCAL_ERROR_PATH = '/system/data/callManager/notexistpath.png';
-export const IMAGE_SPACE_PATH = '';
-export const SENT_STRING_0 = '0';
-export const SENT_STRING_1 = '1';
-export const SENT_STRING_2 = '2';
-export const SENT_STRING_3 = '3';
-export const SENT_STRING_4 = '4';
-export const SENT_STRING_5 = '5';
-export const SENT_STRING_6 = '6';
-export const SENT_STRING_7 = '7';
-export const SENT_STRING_8 = '8';
-export const SENT_STRING_9 = '9';
-export const SENT_STRING_ERROR_10 = '10';
-export const SENT_STRING_A = 'A';
-export const SENT_STRING_Z = 'Z';
-export const SENT_STRING_C = 'C';
-export const SENT_STRING_D = 'D';
-export const SENT_STRING_E = 'E';
-export const SENT_STRING_LOW_A = 'a';
-export const SENT_STRING_LOW_C = 'c';
-export const SENT_STRING_LOW_B = 'b';
-export const SENT_STRING_LOW_D = 'd';
-export const SENT_STRING_STAR = '*';
-export const SENT_STRING_ADD = '+';
-export const SENT_STRING_MINUS = '-';
-export const SENT_STRING_JIN = '#';
-export const CALL_MODE_CS = 0;
-export const CALL_MODE_IMS = 3;
-export const MEDIA_TYPE_VOICE = 0;
-export const MEDIA_TYPE_VIDEO = 1;
-export const MEDIA_TYPE_ERROR = -1;
-export const MEDIA_TYPE_ERROR2 = 2;
-export const DIAL_SCENCE_CALL_NORMAL = 0;
-export const DIAL_SCENCE_CALL_PRIVILEGED = 1;
-export const DIAL_SCENCE_CALL_CALL_EMERGENCY = 2;
-export const DIAL_SCENCE_ERROR = -1;
-export const DIAL_SCENCE_ERROR2 = 3;
-export const DIAL_CARRIER_TYPE = 0;
-export const DIAL_VOICE_MAIL_TYPE = 1;
-export const DIAL_OTT_TYPE = 2;
-export const DIAL_TYPE_ERROR = -1;
-export const DIAL_TYPE_ERROR3 = 3;
-
-export const POS_700 = 700;
-export const POS_10 = 10;
-export const POS_Z_0 = 0;
-export const POS_Z_1 = 1;
-export const POS_Z_ERROR = -1;
-export const POS_Z_ERROR2 = 2;
-export const POS_LENGTH_300 = 300;
-export const POS_LENGTH_600 = 600;
-
-export const ZOOM_RATIO_5_0 = 5.0;
-export const ZOOM_RATIO_15_0 = 15.0;
-export const ZOOM_RATIO_0_0 = 0.0;
-export const ZOOM_RATIO_10_1 = 10.1;
-export const ZOOM_RATIO_MINUS_1_0 = -1.0;
-
-export const ROTATION_0 = 0;
-export const ROTATION_90 = 90;
-export const ROTATION_60 = 60;
-export const ROTATION_180 = 180;
-export const ROTATION_270 = 270;
-export const ROTATION_360 = 360;
-export const ROTATION_MINUS_1 = -1;
-
-export const COMMAND_CALL_WAITTING_OPEN = '*43#';
-export const COMMAND_CALL_WAITTING_CLOSE = '#43#';
-export const COMMAND_CALL_WAITTING_QUERY = '*#43#';
-export const COMMAND_CALL_TRANS_OPEN = '*21*10000000001#';
-export const COMMAND_CALL_TRANS_OPEN2 = '**21*10000000001*10#';
-export const COMMAND_CALL_TRANS_RESET = '##21#';
-export const COMMAND_CALL_ERROR = '**21*10000000001******10#';
-export const COMMAND_CALL_ERROR2 = '*ABCDEF123456789#';
-export const COMMAND_CALL_ERROR3 = '#ABCDEF123456789#';
-export const COMMAND_CALL_ERROR4 = '*#ABCDE123456789#';
-export const COMMAND_CALL_ERROR5 = '**ABCDE123456789#';
-export const COMMAND_CALL_ERROR6 = '##ABCDEF123456789#';
-
-export const CALL_WAITING_DISABLE = 0;
-export const CALL_WAITING_ENABLE = 1;
-
-export const EVENT_SEND_USSD_SUCCESS = 17;
-export const EVENT_SEND_USSD_FAILED = 18;
-export const EVENT_SEND_MEDIA_MODE_UPDATE = 19;
-
-export const RTT_MSG = 'Ab666';
-
-export const CALL_MODE_AUDIO_ONLY = 0;
-export const CALL_MODE_SEND_RECEIVE = 3;
-export const CALL_MODE_SEND_ONLY = 1;
-export const CALL_MODE_RECEIVE_ONLY = 2;
-export const CALL_MODE_VIDEO_PAUSED = 4;
-export const CALL_MODE_INVALID_MINUS_1 = -1;
-export const CALL_MODE_INVALID_5 = 5;
-
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+export const AUTO_ACCEPT_NUMBER = '10010';
+export const AUTO_ACCEPT_NUMBER2 = '10010';
+export const PHONE_NUMBER_AREA_LAND = '089800000000';
+export const PHONE_NUMBER_LENGTH_8 = '86459751';
+
+export const PHONE_NUMBER_LENGTH_11 = '10000000001';
+export const PHONE_NUMBER_VOICE_MAIL = '12599';
+export const PHONE_NUMBER_LONG = '1234567890123456789012345678901234567890123' +
+ '4567890123456789012345678901234567890123456789012345678901';
+export const EMERGENCY_NUMBER = '112';
+export const RIGHT_PASSWORD = '000001';
+export const ERROR_PASSWORD = '1234567890123456789012345678901234567890123' +
+'4567890123456789012345678901234567890123456789012345678901';
+export const CALL_EMERGENCY = 2;
+export const PHONE_LIST = ['10000000001'];
+export const PHONE_LIST2 = ['10000000001', '10000000002'];
+export const NULL_PHONE_NUMBER = '';
+export const SPECIA_CHAR_NUMBER = '"=#$%^&*()+';
+export const PHONE_NUMBER_CHAR = 'abcdefghijk';
+export const BOUNDARY_NUMBER_INT = 2147483649;
+export const MINUS_BOUNDARY_NUMBER_INT = -2147483649;
+export const MINUS_VALUE = -100;
+export const TEST_RELY_NUMBER = 20; // test count for Reliability
+export const TEST_PERF_COUNT = 20; // test count for Perfomace
+export const PERF_GOAL_TIME = TEST_PERF_COUNT * 0.5;
+
+export const CALL_STATUS_ACTIVE = 0;
+export const CALL_STATUS_HOLDING = 1;
+export const CALL_STATUS_DIALING = 2;
+export const CALL_STATUS_ALERTING = 3;
+export const CALL_STATUS_INCOMING = 4;
+export const CALL_STATUS_WAITING = 5;
+export const CALL_STATUS_DISCONNECTED = 6;
+export const CALL_STATUS_DISCONNECTING = 7;
+export const CALL_STATUS_IDLE = 8;
+
+export const TEL_CONFERENCE_IDLE = 0;
+export const TEL_CONFERENCE_ACTIVE = 1;
+export const TEL_CONFERENCE_DISCONNECTING = 2;
+export const TEL_CONFERENCE_DISCONNECTED = 3;
+
+export const DEVICE_EARPIECE = 0;
+export const DEVICE_SPEAKER = 1;
+export const DEVICE_WIRED_HEADSET = 2;
+export const DEVICE_BLUETOOTH_SCO = 3;
+export const DEVICE_INVALID = -1;
+export const DEVICE_INVALID4 = 4;
+
+export const RESTRICTION_MODE_DEACTIVATION = 0;
+export const RESTRICTION_MODE_ACTIVATION = 1;
+export const RESTRICTION_MODE_INVALID = -1;
+export const RESTRICTION_MODE_INVALID2 = 2;
+
+export const RESTRICTION_DISABLE = 0;
+export const RESTRICTION_ENABLE = 1;
+
+export const RESTRICTION_TYPE_ALL_INCOMING = 0;
+export const RESTRICTION_TYPE_ALL_OUTGOING = 1;
+export const RESTRICTION_TYPE_INTERNATIONAL = 2;
+export const RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME = 3;
+export const RESTRICTION_TYPE_ROAMING_INCOMING = 4;
+export const RESTRICTION_TYPE_INCOMING_SERVICES = 7;
+export const RESTRICTION_TYPE_OUTGOING_SERVICES = 6;
+export const RESTRICTION_TYPE_ALL_CALLS = 5;
+export const RESTRICTION_TYPE_INVALID = -1;
+export const RESTRICTION_TYPE_INVALID2 = 8;
+
+export const DEFAULT_SLOT_ID = 0;
+export const SLOT_ID1 = 1;
+export const SLOT_ID_INVALID = -1;
+export const SLOT_ID_INVALID_2 = 2;
+export const CALL_ID_NOT_EXIST = 999;
+export const VIDEO_STATE_AUDIO = 0;
+export const CALL_TYPE_CS = 0;
+export const CALL_TYPE_IMS = 1;
+
+export const EVENT_START_DTMF_SUCCESS = 3;
+export const EVENT_STOP_DTMF_SUCCESS = 5;
+
+export const CALL_STATE_UNKNOWN = -1;
+export const CALL_STATE_IDLE = 0;
+export const CALL_STATE_RINGING = 1;
+export const CALL_STATE_OFFHOOK = 2;
+
+export const TIMEOUT_LENTH = 1000;
+
+// call error code
+export const CALL_MANAGER_NUMBER_NULL_NOTICE = '83951616';
+
+export const TRANSFER_DISABLE = 0; // tran is close
+export const TRANSFER_ENABLE = 1; // tran is open
+
+export const CALL_TRANSFER_ENABLE = 0;
+export const CALL_TRANSFER_DISABLE = 1;
+export const CALL_TRANSFER_REGISTRATION = 3; // open tran function
+export const CALL_TRANSFER_ERASURE = 4; // close tran function
+export const CALL_TRANSFER_INVALID = -1;
+export const CALL_TRANSFER_INVALID2 = 5;
+export const CALL_TRANSFER_INVALID3 = 2;
+
+export const TRANSFER_TYPE_BUSY = 1; // tran busy
+export const TRANSFER_TYPE_NO_REPLY = 2;// no response tran
+export const TRANSFER_TYPE_NOT_REACHABLE = 3; // untouchable(no signal/shut down) tran
+export const TRANSFER_TYPE_UNCONDITIONAL = 0; // unconditional tran
+export const TRANSFER_TYPE_INVALID = -1;
+export const TRANSFER_TYPE_INVALID4 = 4;
+
+export const REACH_TIMES = 10;
+export const AFTER_HANUP_TIMES = 5;
+
+export const CARMER_ID_NOT_EXIT = 'xtsautotest123456';
+export const CARMER_ID_SPACE = '';
+export const IMAGE_PNG_PATH = '/system/data/callManager.png';
+export const IMAGE_JPG_PATH = '/system/data/callManager.jpg';
+export const IMAGE_BMP_PATH = '/system/data/callManager.bmp';
+export const IMAGE_WEBP_PATH = '/system/data/callManager.webp';
+export const IMAGE_LOCAL_ERROR_PATH = '/system/data/callManager/notexistpath.png';
+export const IMAGE_SPACE_PATH = '';
+export const SENT_STRING_0 = '0';
+export const SENT_STRING_1 = '1';
+export const SENT_STRING_2 = '2';
+export const SENT_STRING_3 = '3';
+export const SENT_STRING_4 = '4';
+export const SENT_STRING_5 = '5';
+export const SENT_STRING_6 = '6';
+export const SENT_STRING_7 = '7';
+export const SENT_STRING_8 = '8';
+export const SENT_STRING_9 = '9';
+export const SENT_STRING_ERROR_10 = '10';
+export const SENT_STRING_A = 'A';
+export const SENT_STRING_Z = 'Z';
+export const SENT_STRING_C = 'C';
+export const SENT_STRING_D = 'D';
+export const SENT_STRING_E = 'E';
+export const SENT_STRING_LOW_A = 'a';
+export const SENT_STRING_LOW_C = 'c';
+export const SENT_STRING_LOW_B = 'b';
+export const SENT_STRING_LOW_D = 'd';
+export const SENT_STRING_STAR = '*';
+export const SENT_STRING_ADD = '+';
+export const SENT_STRING_MINUS = '-';
+export const SENT_STRING_JIN = '#';
+export const CALL_MODE_CS = 0;
+export const CALL_MODE_IMS = 3;
+export const MEDIA_TYPE_VOICE = 0;
+export const MEDIA_TYPE_VIDEO = 1;
+export const MEDIA_TYPE_ERROR = -1;
+export const MEDIA_TYPE_ERROR2 = 2;
+export const DIAL_SCENCE_CALL_NORMAL = 0;
+export const DIAL_SCENCE_CALL_PRIVILEGED = 1;
+export const DIAL_SCENCE_CALL_CALL_EMERGENCY = 2;
+export const DIAL_SCENCE_ERROR = -1;
+export const DIAL_SCENCE_ERROR2 = 3;
+export const DIAL_CARRIER_TYPE = 0;
+export const DIAL_VOICE_MAIL_TYPE = 1;
+export const DIAL_OTT_TYPE = 2;
+export const DIAL_TYPE_ERROR = -1;
+export const DIAL_TYPE_ERROR3 = 3;
+
+export const POS_700 = 700;
+export const POS_10 = 10;
+export const POS_Z_0 = 0;
+export const POS_Z_1 = 1;
+export const POS_Z_ERROR = -1;
+export const POS_Z_ERROR2 = 2;
+export const POS_LENGTH_300 = 300;
+export const POS_LENGTH_600 = 600;
+
+export const ZOOM_RATIO_5_0 = 5.0;
+export const ZOOM_RATIO_15_0 = 15.0;
+export const ZOOM_RATIO_0_0 = 0.0;
+export const ZOOM_RATIO_10_1 = 10.1;
+export const ZOOM_RATIO_MINUS_1_0 = -1.0;
+
+export const ROTATION_0 = 0;
+export const ROTATION_90 = 90;
+export const ROTATION_60 = 60;
+export const ROTATION_180 = 180;
+export const ROTATION_270 = 270;
+export const ROTATION_360 = 360;
+export const ROTATION_MINUS_1 = -1;
+
+export const COMMAND_CALL_WAITTING_OPEN = '*43#';
+export const COMMAND_CALL_WAITTING_CLOSE = '#43#';
+export const COMMAND_CALL_WAITTING_QUERY = '*#43#';
+export const COMMAND_CALL_TRANS_OPEN = '*21*10000000001#';
+export const COMMAND_CALL_TRANS_OPEN2 = '**21*10000000001*10#';
+export const COMMAND_CALL_TRANS_RESET = '##21#';
+export const COMMAND_CALL_ERROR = '**21*10000000001******10#';
+export const COMMAND_CALL_ERROR2 = '*ABCDEF123456789#';
+export const COMMAND_CALL_ERROR3 = '#ABCDEF123456789#';
+export const COMMAND_CALL_ERROR4 = '*#ABCDE123456789#';
+export const COMMAND_CALL_ERROR5 = '**ABCDE123456789#';
+export const COMMAND_CALL_ERROR6 = '##ABCDEF123456789#';
+
+export const CALL_WAITING_DISABLE = 0;
+export const CALL_WAITING_ENABLE = 1;
+
+export const EVENT_SEND_USSD_SUCCESS = 17;
+export const EVENT_SEND_USSD_FAILED = 18;
+export const EVENT_SEND_MEDIA_MODE_UPDATE = 19;
+
+export const RTT_MSG = 'Ab666';
+
+export const CALL_MODE_AUDIO_ONLY = 0;
+export const CALL_MODE_SEND_RECEIVE = 3;
+export const CALL_MODE_SEND_ONLY = 1;
+export const CALL_MODE_RECEIVE_ONLY = 2;
+export const CALL_MODE_VIDEO_PAUSED = 4;
+export const CALL_MODE_INVALID_MINUS_1 = -1;
+export const CALL_MODE_INVALID_5 = 5;
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceInCalling.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceInCalling.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceInCalling.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceInCalling.js
index 6dd3654dd28d5e0b26949d0c471986ccfe662463..301d7202311d179865e6552115811a8a225748ce 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceInCalling.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceInCalling.js
@@ -1,684 +1,684 @@
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- CALL_MANAGER_NUMBER_NULL_NOTICE,
- NULL_PHONE_NUMBER,
- CALL_STATUS_HOLDING,
- CALL_STATUS_DIALING,
- CALL_STATUS_DISCONNECTED,
- CALL_STATUS_DISCONNECTING,
- TIMEOUT_LENTH,
- DEFAULT_SLOT_ID,
- CALL_STATUS_ACTIVE,
- REACH_TIMES,
- AFTER_HANUP_TIMES
-} from './Const.js';
-import {toString} from './ApiToPromise.js';
-import call from '@ohos.telephony.call';
-import observer from '@ohos.telephony.observer';
-
-let hunupTimeOut = null;
-
-export function clearHandupTime (caseName) {
- console.log(`${caseName} clearHandupTime success`);
- clearTimeout(hunupTimeOut);
-}
-
-let stateStorage = [];
-export let callId = null;
-export function callDetailsChangeOn () {
- console.log('Telephony_CallManager callDetailsChangeOn');
- call.on('callDetailsChange', (err, callStateInfo) => {
- console.log(`Telephony_CallManager callDetailsChange error ${toString(err)}` +
- `,callStateInfo ${toString(callStateInfo)}`);
- if (callStateInfo) {
- stateStorage.push({...callStateInfo});
- callId = callStateInfo.callId;
- }
- });
-}
-export function callDetailsChangeOff () {
- console.log('Telephony_CallManager callDetailsChangeOff');
- call.off('callDetailsChange');
-}
-
-let reachStateTimeout = null;
-export function reachState (caseName, checkState, tag, isHunup, target) {
- clearInterval(reachStateTimeout);
- stateStorage = [];
- let oldTime = new Date();
- let timeoutflag = false;
- let timeOutLenth = 2 * REACH_TIMES * TIMEOUT_LENTH;
- return new Promise((resolve, reject) => {
- reachStateTimeout = setInterval(() => {
- let now = new Date();
- console.log(`${caseName} ${tag} reachState now:${toString(now)},stateStorage:${toString({stateStorage})}`);
- let find = stateStorage.find(ele => {
- if (target && target.callId === null && ele.callState === CALL_STATUS_DIALING) {
- target.callId = ele.callId;
- }
- if (target) { // be satisfied with multing call
- return ele.callState === checkState && ele.callId === target.callId;
- } else {
- return ele.callState === checkState;
- }
- });
- if (find) {
- clearInterval(reachStateTimeout);
- const message = `${caseName} ${tag} reachState,get the right state checkState:${checkState}`;
- console.log(message);
- resolve(find);
- return;
- }
- find = stateStorage.find(ele => {
- if (target) { // be satisfied with multing call
- return ele.callState === CALL_STATUS_DISCONNECTED && ele.callId === target.callId;
- } else {
- return ele.callState === CALL_STATUS_DISCONNECTED;
- }
- });
- if (find) {
- clearInterval(reachStateTimeout);
- reachStateTimeout = setTimeout(() => {
- const message = `${caseName} ${tag} reachState,get the state CALL_STATUS_DISCONNECTED from` +
- ` ${timeoutflag ? 'local' : 'opposite'}, callId ${find.callId}`;
- console.log(message);
- if (target) { // be satisfied with multing call
- target.callId = null;
- }
- reject(new Error(message));
- }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
- return;
- }
- if (new Date() - oldTime > timeOutLenth) {
- if (isHunup) {
- const message = `${caseName} ${tag} timeout,hunup is runed`;
- console.log(message);
- clearInterval(reachStateTimeout);
- reject(new Error(message));
- return;
- }
- if (timeoutflag === false) {
- timeoutflag = true;
- let callId = target ? target.callId : callId;// be satisfied with multing call
- if (!callId) {
- clearInterval(reachStateTimeout);
- const message = `${caseName} ${tag} timeout reachState,callId is not exit`;
- reject(new Error(message));
- return;
- }
- const message = `${caseName} ${tag} timeout reachState,start hunupCall`;
- console.log(message);
- hangupCall(caseName, callId).then(data => {
- const message = `${caseName} ${tag} timeout hangupCall success,data:${toString(data)}`;
- console.log(message);
- clearInterval(reachStateTimeout);
- reject(new Error(message));
- }).catch(error => {
- clearInterval(reachStateTimeout);
- const message = `${caseName} ${tag} timeout hangupCall error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- }
- }
- }, 1 * TIMEOUT_LENTH);
- });
-}
-
-export function clearReachState () {
- clearInterval(reachStateTimeout);
-}
-
-// dial call in a nomal scence,when specific state arrive,we get the information of this state
-export function scenceInCalling (options) {
- console.log(`scenceInCalling options ${toString(options)}`);
- if (!options.target) { // be satisfied with multing call
- callId = null;
- }
- return new Promise((resolve, reject) => {
- let {caseName, phoneNumber, checkState, dialOptions, target} = options;
- try {
- reachState(caseName, checkState, 'scenceInCalling', false, target)// be satisfied with multing call
- .then(data => {
- const message = `${caseName} reach the right state success,data:${toString(data)}`;
- console.log(message);
- resolve(data);
- })
- .catch(error => {
- const message = `${caseName} reach the right state error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- const callback = (error, data) => {
- if (error) {
- const message = `${caseName} scenceInCalling dial error,error:${toString(error)}`;
- console.log(message);
- clearReachState();
- reject(new Error(message));
- return;
- }
- if (data !== true) {
- const message = `${caseName} scenceInCalling dial data error,data:${toString(data)}`;
- console.log(message);
- clearReachState();
- reject(new Error(message));
- return;
- }
- console.log(`${caseName} dial true,run continue`);
- };
- let arg = [phoneNumber];
- if (dialOptions) {
- arg.push(dialOptions);
- }
- arg.push(callback);
- call.dial(...arg);
- } catch (error) {
- const message = `${caseName} dial try catch error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- }
- });
-}
-
-/* normal function
- dial a call with number '',we shoudld get the error */
-export function scenceInCallingNull (options) {
- console.log(`scenceInCallingNull options ${toString(options)}`);
- return new Promise((resolve, reject) => {
- let {caseName, dialOptions} = options;
- const callback = (err, data) => {
- if (err && err.message === CALL_MANAGER_NUMBER_NULL_NOTICE) {
- console.log(`${caseName} dial call null number,data:${toString(err)}`);
- resolve(data);
- return;
- }
- const message = `${caseName} should be CALL_MANAGER_NUMBER_NULL_NOTICE,` +
- `dial error:${toString(err)},data:${toString(data)}`;
- console.log(message);
- reject(new Error(message));
- };
- let arg = [NULL_PHONE_NUMBER];
- if (dialOptions) {
- arg.push(dialOptions);
- }
- arg.push(callback);
- try {
- call.dial(...arg);
- } catch (error) {
- const message = `${caseName} error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- }
- });
-}
-
-// holding call scence,use it should base on scenceInCalling,get the information at CALL_STATUS_HOLDING state
-export function scenceInHolding (options) {
- console.log(`scenceInHolding options ${toString(options)}`);
- return new Promise(async (resolve, reject) => {
- let {caseName, callId} = options;
- if (callId) {
- reachState(caseName, CALL_STATUS_HOLDING, 'scenceInHolding', false)
- .then(data => {
- const message = `${caseName} scenceInHolding get the right state success,data:${toString(data)}`;
- console.log(message);
- resolve(data);
- })
- .catch(error => {
- const message = `${caseName} scenceInHolding get the right state error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- call.holdCall(callId, (error, data) => {
- if (error) {
- const message = `${caseName} scenceInHolding holdCall error,error:${toString(error)}`;
- console.log(message);
- clearReachState();
- reject(new Error(message));
- }
-
- });
- } else {
- const message = `${caseName} scenceInHolding error,need callId`;
- console.log(message);
- reject(new Error(message));
- }
- });
-}
-
-export function scenceInUnHolding (options) {
- console.log(`scenceInUnHolding options ${toString(options)}`);
- return new Promise(async (resolve, reject) => {
- let {caseName, callId} = options;
- if (callId) {
- reachState(caseName, CALL_STATUS_ACTIVE, 'scenceInUnHolding', false)
- .then(data => {
- const message = `${caseName} scenceInUnHolding get the right state success,data:${toString(data)}`;
- console.log(message);
- resolve(data);
- })
- .catch(error => {
- const message = `${caseName} scenceInUnHolding get the right state error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- call.unHoldCall(callId, (error, data) => {
- if (error) {
- const message = `${caseName} scenceInUnHolding error,error:${toString(error)}`;
- console.log(message);
- clearReachState();
- reject(new Error(message));
- }
-
- });
- } else {
- const message = `${caseName} scenceInUnHolding error,need callId`;
- console.log(message);
- reject(new Error(message));
- }
- });
-}
-
-// hunup call scence,use it should base on scenceInCalling,specific state arrive,get the information at this state
-export function scenceInHangup (options) {
- console.log(`scenceInHangup options ${toString(options)}`);
- return new Promise(async (resolve, reject) => {
- let {caseName, callId, checkState} = options;
- if (callId) {
- reachState(caseName, checkState, 'scenceInHangup', true).then(data => {
- const message = `${caseName} scenceInHangup get the right state success ,data:${toString(data)}`;
- console.log(message);
- resolve(data);
- }).catch(error => {
- const message = `${caseName} scenceInHangup get the right state error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- call.hangup(callId)
- .then((data) => {
- const message = `${caseName} scenceInHangup data,data:${toString(data)}`;
- console.log(message);
- })
- .catch(error => {
- const message = `${caseName} func hangup,error:${toString(error)}`;
- console.log(message);
- clearReachState();
- reject(new Error(message));
- });
-
- } else {
- const message = `${caseName} scenceInHangup error,need callId`;
- console.log(message);
- reject(new Error(message));
- }
- });
-}
-
-// hunup the call ,used in test case
-export function hangupCall2 (caseName, done, callId, delaytime) {
- let timeout = null;
- if (callId) {
- const message = `${caseName} hunup,hangupCall2 callId ${callId}`;
- console.log(message);
- reachState(caseName, CALL_STATUS_DISCONNECTED, 'hangupCall2', true)
- .then(data => {
- const message = `${caseName} hangupCall2 get right state success,data:${toString(data)}`;
- console.log(message);
- clearTimeout(timeout);
- timeout = setTimeout(function () {
- done();
- }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
- })
- .catch(error => {
- const message = `${caseName} hangupCall2 get right state error,error:${toString(error)}`;
- console.log(message);
- });
- call.hangup(callId)
- .then((data) => {
- console.log(`${caseName} func hangup success,${toString(data)}`);
- })
- .catch(error => {
- const message = `${caseName} func hangup,error:${toString(error)}`;
- console.log(message);
- clearReachState();
- done();
- });
-
- } else {
- const message = `${caseName} hangupCall2 error,need callId`;
- console.log(message);
- done();
- }
-}
-
-// hunup the call ,used in packaging function
-export function hangupCall (caseName, callId) {
- return new Promise((resolve, reject) => {
- let timeout = null;
- if (callId) {
- let message = `${caseName} hunup,hangupCall callId:${callId}`;
- console.log(message);
- reachState(caseName, CALL_STATUS_DISCONNECTED, 'hangupCall', true)
- .then(data => {
- const message = `${caseName} hangupCall get right state success,data:${toString(data)}`;
- console.log(message);
- clearTimeout(timeout);
- timeout = setTimeout(function () {
- resolve(data);
- }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
- })
- .catch(error => {
- const message = `${caseName} hangupCall get right state error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- call.hangup(callId)
- .then((data) => {
- console.log(`${caseName} func hangup success,${toString(data)}`);
- })
- .catch(error => {
- const message = `${caseName} func hangup,error:${toString(error)}`;
- console.log(message);
- clearReachState();
- reject(new Error(message));
- });
- } else {
- const message = `${caseName} func hangup error,need callId`;
- console.log(message);
- reject(new Error(message));
- }
-
- });
-}
-
-/* dial call in a nomal scence used in third-party applications,when specific state arrive,
- we get the information of this state */
-export function scenceInCallingForRegister (options) {
- console.log(`scenceInCallingForRegister options ${toString(options)}`);
- return new Promise((resolve, reject) => {
- let {caseName} = options;
- let callId = null;
- let callChangeData = null;
- let func = null;
- let count = 0;
- if (options.isOnce) {
- func = observer.once;
- } else {
- func = observer.on;
- }
- if (typeof func !== 'function') {
- let message = `${caseName} observer.once or observer.on is not exit,options:${toString(options)}`;
- console.log(message);
- reject(new Error(message));
- return;
- }
- func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
- console.log(`${caseName} callStateChange,data:${toString(data)}`);
- callChangeData = data;
- count++;
- });
-
- scenceInCalling({...options})
- .then(data => {
- callId = data.callId;
- let tempCallChangeData = {count, ...callChangeData};
- console.log(`${caseName} scenceInCalling data,data:${toString(data)},` +
- `tempCallChangeData:${toString(tempCallChangeData)}`);
- observer.off('callStateChange');
- hangupCall(caseName, callId)
- .then(data => {
- console.log(`${caseName} scenceInCalling hangupCall data,data:${toString(data)}`);
- resolve(tempCallChangeData);
- })
- .catch(error => {
- const message = `${caseName} scenceInCalling hangupCall error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- });
-}
-
-// holding call scence used in third-party applications,we get the information of state at CALL_STATUS_HOLDING state
-export function scenceInCallingHoldingForRegister (options) {
- console.log(`scenceInCallingHoldingForRegister options ${toString(options)}`);
- return new Promise((resolve, reject) => {
- let {caseName} = options;
- let callId = null;
- let callChangeData = null;
- let func = null;
- let count = 0;
- if (options.isOnce) {
- func = observer.once;
- } else {
- func = observer.on;
- }
- if (typeof func !== 'function') {
- reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
- return;
- }
- func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
- console.log(`${caseName} callStateChange,data:${toString(data)}`);
- count++;
- callChangeData = data;
- });
- scenceInCalling(options)
- .then(data => {
- scenceInHolding({callId:data.callId, ...options})
- .then(data => {
- callId = data.callId;
- let tempCallChangeData = {count, ...callChangeData};
- console.log(`${caseName} scenceInHolding data,data:${toString(data)}` +
- `,tempCallChangeData:${toString(tempCallChangeData)}`);
- observer.off('callStateChange');
- hangupCall(caseName, callId)
- .then(data => {
- console.log(`${caseName} hangupCall data,data:${toString(data)}`);
- resolve(tempCallChangeData);
- })
- .catch(error => {
- const message = `${caseName} hangupCall error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} scenceInHolding ,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- });
-}
-
-// holding call scence used in third-party applications,we get the information of state when unHoldCall the call
-export function scenceInCallingNnHoldingForRegister (options) {
- console.log(`scenceInCallingNnHoldingForRegister options ${toString(options)}`);
- return new Promise((resolve, reject) => {
- let {caseName} = options;
- let callId = null;
- let callChangeData = null;
- let func = null;
- let count = 0;
- if (options.isOnce) {
- func = observer.once;
- } else {
- func = observer.on;
- }
- if (typeof func !== 'function') {
- reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
- return;
- }
- func('callStateChange', {slotId:DEFAULT_SLOT_ID}, (data) => {
- console.log(`${caseName} callStateChange,data:${toString(data)}`);
- count++;
- callChangeData = data;
- });
- scenceInCalling(options)
- .then(data => {
- scenceInHolding({callId:data.callId, ...options})
- .then(data => {
- callId = data.callId;
- scenceInUnHolding({callId:data.callId, ...options})
- .then(data => {
- let tempCallChangeData = {count, ...callChangeData};
- console.log(`${caseName} unHoldCall data,data:${toString(data)},
- tempCallChangeData:${toString(tempCallChangeData)}`);
- observer.off('callStateChange');
- hangupCall(caseName, callId)
- .then(data => {
- console.log(`${caseName} hangupCall data,data:${toString(data)}`);
- resolve(tempCallChangeData);
- })
- .catch(error => {
- const message = `${caseName} hangupCall error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} unHoldCall error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} scenceInHolding error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- });
-}
-
-// hunup call scence used in third-party applications,we get the information of state when hunup the call
-export function scenceInCallingHangupForRegister (options) {
- console.log(`scenceInCallingHangupForRegister options ${toString(options)}`);
- return new Promise((resolve, reject) => {
- let {caseName} = options;
- let callId = null;
- let callChangeData = null;
- let func = null;
- let count = 0;
- if (options.isOnce) {
- func = observer.once;
- } else {
- func = observer.on;
- }
- if (typeof func !== 'function') {
- reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
- return;
- }
- func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
- console.log(`${caseName} callStateChange,data:${toString(data)}`);
- count++;
- callChangeData = data;
- });
- scenceInCalling(options)
- .then(data => {
- options.checkState = CALL_STATUS_DISCONNECTED;
- scenceInHangup({callId:data.callId, ...options})
- .then(data => {
- callId = data.callId;
- let tempCallChangeData = {count, ...callChangeData};
- console.log(`${caseName} scenceInHangup data,data:${toString(data)},` +
- `tempCallChangeData:${toString(tempCallChangeData)}`);
- observer.off('callStateChange');
- resolve(tempCallChangeData);
- })
- .catch(error => {
- const message = `${caseName} scenceInHangup error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- })
- .catch(error => {
- const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
- console.log(message);
- reject(new Error(message));
- });
- });
-}
-
-export function isHanupEd (state) {
- return (state === CALL_STATUS_DISCONNECTING) || (state === CALL_STATUS_DISCONNECTED);
-}
-
-export function reachCallEventState (eventId) {
- return new Promise(function (resolve, reject) {
- let time = null;
- call.on('callEventChange', (err, value) => {
- console.log(`Telephony_CallManager callEventChange error ${toString(err)},callStateInfo ${
- toString(value)}`);
- if (err) {
- let message = `Telephony_CallManager reachCallEventState err message = ${toString(err)}`;
- console.log(message);
- clearTimeout(time);
- reject(new Error(message));
- return;
- }
- if (eventId === value.eventId) {
- let message = `Telephony_CallManager reachCallEventState get the right eventId ${toString(value)}`;
- console.log(message);
- clearTimeout(time);
- resolve(value);
- } else {
- let message = `Telephony_CallManager reachCallEventState get the error eventId ${toString(value)}`;
- console.log(message);
- clearTimeout(time);
- reject(new Error(message));
- }
- });
- time = setTimeout(function () {
- let message = 'Telephony_CallManager reachCallEventState time out';
- console.log(message);
- reject(new Error(message));
- }, 20 * TIMEOUT_LENTH);
- });
-}
-
-export class TeleCall {
- constructor () {
- this.callId = null;
- }
- callScenceInCalling (options) {
- this.callId = null;
- options.target = this;
- return scenceInCalling(options);
- }
- callReachState (caseName, checkState, tag, isHunup) {
- return reachState(caseName, checkState, tag, isHunup, this);
- }
- callHangupCall (caseName) {
- return hangupCall(caseName, this.callId, this);
- }
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {
+ CALL_MANAGER_NUMBER_NULL_NOTICE,
+ NULL_PHONE_NUMBER,
+ CALL_STATUS_HOLDING,
+ CALL_STATUS_DIALING,
+ CALL_STATUS_DISCONNECTED,
+ CALL_STATUS_DISCONNECTING,
+ TIMEOUT_LENTH,
+ DEFAULT_SLOT_ID,
+ CALL_STATUS_ACTIVE,
+ REACH_TIMES,
+ AFTER_HANUP_TIMES
+} from './Const.js';
+import {toString} from './ApiToPromise.js';
+import call from '@ohos.telephony.call';
+import observer from '@ohos.telephony.observer';
+
+let hunupTimeOut = null;
+
+export function clearHandupTime (caseName) {
+ console.log(`${caseName} clearHandupTime success`);
+ clearTimeout(hunupTimeOut);
+}
+
+let stateStorage = [];
+export let callId = null;
+export function callDetailsChangeOn () {
+ console.log('Telephony_CallManager callDetailsChangeOn');
+ call.on('callDetailsChange', (err, callStateInfo) => {
+ console.log(`Telephony_CallManager callDetailsChange error ${toString(err)}` +
+ `,callStateInfo ${toString(callStateInfo)}`);
+ if (callStateInfo) {
+ stateStorage.push({...callStateInfo});
+ callId = callStateInfo.callId;
+ }
+ });
+}
+export function callDetailsChangeOff () {
+ console.log('Telephony_CallManager callDetailsChangeOff');
+ call.off('callDetailsChange');
+}
+
+let reachStateTimeout = null;
+export function reachState (caseName, checkState, tag, isHunup, target) {
+ clearInterval(reachStateTimeout);
+ stateStorage = [];
+ let oldTime = new Date();
+ let timeoutflag = false;
+ let timeOutLenth = 2 * REACH_TIMES * TIMEOUT_LENTH;
+ return new Promise((resolve, reject) => {
+ reachStateTimeout = setInterval(() => {
+ let now = new Date();
+ console.log(`${caseName} ${tag} reachState now:${toString(now)},stateStorage:${toString({stateStorage})}`);
+ let find = stateStorage.find(ele => {
+ if (target && target.callId === null && ele.callState === CALL_STATUS_DIALING) {
+ target.callId = ele.callId;
+ }
+ if (target) { // be satisfied with multing call
+ return ele.callState === checkState && ele.callId === target.callId;
+ } else {
+ return ele.callState === checkState;
+ }
+ });
+ if (find) {
+ clearInterval(reachStateTimeout);
+ const message = `${caseName} ${tag} reachState,get the right state checkState:${checkState}`;
+ console.log(message);
+ resolve(find);
+ return;
+ }
+ find = stateStorage.find(ele => {
+ if (target) { // be satisfied with multing call
+ return ele.callState === CALL_STATUS_DISCONNECTED && ele.callId === target.callId;
+ } else {
+ return ele.callState === CALL_STATUS_DISCONNECTED;
+ }
+ });
+ if (find) {
+ clearInterval(reachStateTimeout);
+ reachStateTimeout = setTimeout(() => {
+ const message = `${caseName} ${tag} reachState,get the state CALL_STATUS_DISCONNECTED from` +
+ ` ${timeoutflag ? 'local' : 'opposite'}, callId ${find.callId}`;
+ console.log(message);
+ if (target) { // be satisfied with multing call
+ target.callId = null;
+ }
+ reject(new Error(message));
+ }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
+ return;
+ }
+ if (new Date() - oldTime > timeOutLenth) {
+ if (isHunup) {
+ const message = `${caseName} ${tag} timeout,hunup is runed`;
+ console.log(message);
+ clearInterval(reachStateTimeout);
+ reject(new Error(message));
+ return;
+ }
+ if (timeoutflag === false) {
+ timeoutflag = true;
+ let callId = target ? target.callId : callId;// be satisfied with multing call
+ if (!callId) {
+ clearInterval(reachStateTimeout);
+ const message = `${caseName} ${tag} timeout reachState,callId is not exit`;
+ reject(new Error(message));
+ return;
+ }
+ const message = `${caseName} ${tag} timeout reachState,start hunupCall`;
+ console.log(message);
+ hangupCall(caseName, callId).then(data => {
+ const message = `${caseName} ${tag} timeout hangupCall success,data:${toString(data)}`;
+ console.log(message);
+ clearInterval(reachStateTimeout);
+ reject(new Error(message));
+ }).catch(error => {
+ clearInterval(reachStateTimeout);
+ const message = `${caseName} ${tag} timeout hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ }
+ }
+ }, 1 * TIMEOUT_LENTH);
+ });
+}
+
+export function clearReachState () {
+ clearInterval(reachStateTimeout);
+}
+
+// dial call in a nomal scence,when specific state arrive,we get the information of this state
+export function scenceInCalling (options) {
+ console.log(`scenceInCalling options ${toString(options)}`);
+ if (!options.target) { // be satisfied with multing call
+ callId = null;
+ }
+ return new Promise((resolve, reject) => {
+ let {caseName, phoneNumber, checkState, dialOptions, target} = options;
+ try {
+ reachState(caseName, checkState, 'scenceInCalling', false, target)// be satisfied with multing call
+ .then(data => {
+ const message = `${caseName} reach the right state success,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ })
+ .catch(error => {
+ const message = `${caseName} reach the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ const callback = (error, data) => {
+ if (error) {
+ const message = `${caseName} scenceInCalling dial error,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ return;
+ }
+ if (data !== true) {
+ const message = `${caseName} scenceInCalling dial data error,data:${toString(data)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ return;
+ }
+ console.log(`${caseName} dial true,run continue`);
+ };
+ let arg = [phoneNumber];
+ if (dialOptions) {
+ arg.push(dialOptions);
+ }
+ arg.push(callback);
+ call.dial(...arg);
+ } catch (error) {
+ const message = `${caseName} dial try catch error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+/* normal function
+ dial a call with number '',we shoudld get the error */
+export function scenceInCallingNull (options) {
+ console.log(`scenceInCallingNull options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName, dialOptions} = options;
+ const callback = (err, data) => {
+ if (err && err.message === CALL_MANAGER_NUMBER_NULL_NOTICE) {
+ console.log(`${caseName} dial call null number,data:${toString(err)}`);
+ resolve(data);
+ return;
+ }
+ const message = `${caseName} should be CALL_MANAGER_NUMBER_NULL_NOTICE,` +
+ `dial error:${toString(err)},data:${toString(data)}`;
+ console.log(message);
+ reject(new Error(message));
+ };
+ let arg = [NULL_PHONE_NUMBER];
+ if (dialOptions) {
+ arg.push(dialOptions);
+ }
+ arg.push(callback);
+ try {
+ call.dial(...arg);
+ } catch (error) {
+ const message = `${caseName} error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+// holding call scence,use it should base on scenceInCalling,get the information at CALL_STATUS_HOLDING state
+export function scenceInHolding (options) {
+ console.log(`scenceInHolding options ${toString(options)}`);
+ return new Promise(async (resolve, reject) => {
+ let {caseName, callId} = options;
+ if (callId) {
+ reachState(caseName, CALL_STATUS_HOLDING, 'scenceInHolding', false)
+ .then(data => {
+ const message = `${caseName} scenceInHolding get the right state success,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHolding get the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.holdCall(callId, (error, data) => {
+ if (error) {
+ const message = `${caseName} scenceInHolding holdCall error,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ }
+
+ });
+ } else {
+ const message = `${caseName} scenceInHolding error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+export function scenceInUnHolding (options) {
+ console.log(`scenceInUnHolding options ${toString(options)}`);
+ return new Promise(async (resolve, reject) => {
+ let {caseName, callId} = options;
+ if (callId) {
+ reachState(caseName, CALL_STATUS_ACTIVE, 'scenceInUnHolding', false)
+ .then(data => {
+ const message = `${caseName} scenceInUnHolding get the right state success,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInUnHolding get the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.unHoldCall(callId, (error, data) => {
+ if (error) {
+ const message = `${caseName} scenceInUnHolding error,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ }
+
+ });
+ } else {
+ const message = `${caseName} scenceInUnHolding error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+// hunup call scence,use it should base on scenceInCalling,specific state arrive,get the information at this state
+export function scenceInHangup (options) {
+ console.log(`scenceInHangup options ${toString(options)}`);
+ return new Promise(async (resolve, reject) => {
+ let {caseName, callId, checkState} = options;
+ if (callId) {
+ reachState(caseName, checkState, 'scenceInHangup', true).then(data => {
+ const message = `${caseName} scenceInHangup get the right state success ,data:${toString(data)}`;
+ console.log(message);
+ resolve(data);
+ }).catch(error => {
+ const message = `${caseName} scenceInHangup get the right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.hangup(callId)
+ .then((data) => {
+ const message = `${caseName} scenceInHangup data,data:${toString(data)}`;
+ console.log(message);
+ })
+ .catch(error => {
+ const message = `${caseName} func hangup,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ });
+
+ } else {
+ const message = `${caseName} scenceInHangup error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+ });
+}
+
+// hunup the call ,used in test case
+export function hangupCall2 (caseName, done, callId, delaytime) {
+ let timeout = null;
+ if (callId) {
+ const message = `${caseName} hunup,hangupCall2 callId ${callId}`;
+ console.log(message);
+ reachState(caseName, CALL_STATUS_DISCONNECTED, 'hangupCall2', true)
+ .then(data => {
+ const message = `${caseName} hangupCall2 get right state success,data:${toString(data)}`;
+ console.log(message);
+ clearTimeout(timeout);
+ timeout = setTimeout(function () {
+ done();
+ }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall2 get right state error,error:${toString(error)}`;
+ console.log(message);
+ });
+ call.hangup(callId)
+ .then((data) => {
+ console.log(`${caseName} func hangup success,${toString(data)}`);
+ })
+ .catch(error => {
+ const message = `${caseName} func hangup,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ done();
+ });
+
+ } else {
+ const message = `${caseName} hangupCall2 error,need callId`;
+ console.log(message);
+ done();
+ }
+}
+
+// hunup the call ,used in packaging function
+export function hangupCall (caseName, callId) {
+ return new Promise((resolve, reject) => {
+ let timeout = null;
+ if (callId) {
+ let message = `${caseName} hunup,hangupCall callId:${callId}`;
+ console.log(message);
+ reachState(caseName, CALL_STATUS_DISCONNECTED, 'hangupCall', true)
+ .then(data => {
+ const message = `${caseName} hangupCall get right state success,data:${toString(data)}`;
+ console.log(message);
+ clearTimeout(timeout);
+ timeout = setTimeout(function () {
+ resolve(data);
+ }, AFTER_HANUP_TIMES * TIMEOUT_LENTH);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall get right state error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ call.hangup(callId)
+ .then((data) => {
+ console.log(`${caseName} func hangup success,${toString(data)}`);
+ })
+ .catch(error => {
+ const message = `${caseName} func hangup,error:${toString(error)}`;
+ console.log(message);
+ clearReachState();
+ reject(new Error(message));
+ });
+ } else {
+ const message = `${caseName} func hangup error,need callId`;
+ console.log(message);
+ reject(new Error(message));
+ }
+
+ });
+}
+
+/* dial call in a nomal scence used in third-party applications,when specific state arrive,
+ we get the information of this state */
+export function scenceInCallingForRegister (options) {
+ console.log(`scenceInCallingForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ let message = `${caseName} observer.once or observer.on is not exit,options:${toString(options)}`;
+ console.log(message);
+ reject(new Error(message));
+ return;
+ }
+ func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ callChangeData = data;
+ count++;
+ });
+
+ scenceInCalling({...options})
+ .then(data => {
+ callId = data.callId;
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} scenceInCalling data,data:${toString(data)},` +
+ `tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ hangupCall(caseName, callId)
+ .then(data => {
+ console.log(`${caseName} scenceInCalling hangupCall data,data:${toString(data)}`);
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+// holding call scence used in third-party applications,we get the information of state at CALL_STATUS_HOLDING state
+export function scenceInCallingHoldingForRegister (options) {
+ console.log(`scenceInCallingHoldingForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
+ return;
+ }
+ func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ count++;
+ callChangeData = data;
+ });
+ scenceInCalling(options)
+ .then(data => {
+ scenceInHolding({callId:data.callId, ...options})
+ .then(data => {
+ callId = data.callId;
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} scenceInHolding data,data:${toString(data)}` +
+ `,tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ hangupCall(caseName, callId)
+ .then(data => {
+ console.log(`${caseName} hangupCall data,data:${toString(data)}`);
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHolding ,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+// holding call scence used in third-party applications,we get the information of state when unHoldCall the call
+export function scenceInCallingNnHoldingForRegister (options) {
+ console.log(`scenceInCallingNnHoldingForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
+ return;
+ }
+ func('callStateChange', {slotId:DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ count++;
+ callChangeData = data;
+ });
+ scenceInCalling(options)
+ .then(data => {
+ scenceInHolding({callId:data.callId, ...options})
+ .then(data => {
+ callId = data.callId;
+ scenceInUnHolding({callId:data.callId, ...options})
+ .then(data => {
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} unHoldCall data,data:${toString(data)},
+ tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ hangupCall(caseName, callId)
+ .then(data => {
+ console.log(`${caseName} hangupCall data,data:${toString(data)}`);
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} hangupCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} unHoldCall error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHolding error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+// hunup call scence used in third-party applications,we get the information of state when hunup the call
+export function scenceInCallingHangupForRegister (options) {
+ console.log(`scenceInCallingHangupForRegister options ${toString(options)}`);
+ return new Promise((resolve, reject) => {
+ let {caseName} = options;
+ let callId = null;
+ let callChangeData = null;
+ let func = null;
+ let count = 0;
+ if (options.isOnce) {
+ func = observer.once;
+ } else {
+ func = observer.on;
+ }
+ if (typeof func !== 'function') {
+ reject(new Error(`${caseName} observer.once or observer.on is not exit,options:${toString(options)}`));
+ return;
+ }
+ func('callStateChange', {slotId: DEFAULT_SLOT_ID}, (data) => {
+ console.log(`${caseName} callStateChange,data:${toString(data)}`);
+ count++;
+ callChangeData = data;
+ });
+ scenceInCalling(options)
+ .then(data => {
+ options.checkState = CALL_STATUS_DISCONNECTED;
+ scenceInHangup({callId:data.callId, ...options})
+ .then(data => {
+ callId = data.callId;
+ let tempCallChangeData = {count, ...callChangeData};
+ console.log(`${caseName} scenceInHangup data,data:${toString(data)},` +
+ `tempCallChangeData:${toString(tempCallChangeData)}`);
+ observer.off('callStateChange');
+ resolve(tempCallChangeData);
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInHangup error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ })
+ .catch(error => {
+ const message = `${caseName} scenceInCalling error,error:${toString(error)}`;
+ console.log(message);
+ reject(new Error(message));
+ });
+ });
+}
+
+export function isHanupEd (state) {
+ return (state === CALL_STATUS_DISCONNECTING) || (state === CALL_STATUS_DISCONNECTED);
+}
+
+export function reachCallEventState (eventId) {
+ return new Promise(function (resolve, reject) {
+ let time = null;
+ call.on('callEventChange', (err, value) => {
+ console.log(`Telephony_CallManager callEventChange error ${toString(err)},callStateInfo ${
+ toString(value)}`);
+ if (err) {
+ let message = `Telephony_CallManager reachCallEventState err message = ${toString(err)}`;
+ console.log(message);
+ clearTimeout(time);
+ reject(new Error(message));
+ return;
+ }
+ if (eventId === value.eventId) {
+ let message = `Telephony_CallManager reachCallEventState get the right eventId ${toString(value)}`;
+ console.log(message);
+ clearTimeout(time);
+ resolve(value);
+ } else {
+ let message = `Telephony_CallManager reachCallEventState get the error eventId ${toString(value)}`;
+ console.log(message);
+ clearTimeout(time);
+ reject(new Error(message));
+ }
+ });
+ time = setTimeout(function () {
+ let message = 'Telephony_CallManager reachCallEventState time out';
+ console.log(message);
+ reject(new Error(message));
+ }, 20 * TIMEOUT_LENTH);
+ });
+}
+
+export class TeleCall {
+ constructor () {
+ this.callId = null;
+ }
+ callScenceInCalling (options) {
+ this.callId = null;
+ options.target = this;
+ return scenceInCalling(options);
+ }
+ callReachState (caseName, checkState, tag, isHunup) {
+ return reachState(caseName, checkState, tag, isHunup, this);
+ }
+ callHangupCall (caseName) {
+ return hangupCall(caseName, this.callId, this);
+ }
}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceLimitCalling.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceLimitCalling.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceLimitCalling.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceLimitCalling.js
index eade0379d5f3b350b391ea9352c4b15490245a63..d1fe283b148da70b0eb36ba12af1ba9238f2046b 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceLimitCalling.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceLimitCalling.js
@@ -1,57 +1,57 @@
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {RIGHT_PASSWORD, DEFAULT_SLOT_ID, RESTRICTION_MODE_DEACTIVATION} from './Const.js';
-import {toString} from './ApiToPromise.js';
-import call from '@ohos.telephony.call';
-
-// limit call scence
-export function scenceLimitCalling (caseName, type, mode, slotId) {
- return new Promise((resolve, reject) => {
- console.log(`${caseName} scenceLimitCalling type:${type},mode:${mode}`);
- call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
- type,
- mode,
- password:RIGHT_PASSWORD,
- })
- .then(data => {
- console.log(`${caseName} setCallRestriction success, data:${toString(data)}`);
- resolve(data);
- })
- .catch((error) => {
- console.log(`${caseName} setCallRestriction error,error:${toString(error)}`);
- reject(error);
- });
- });
-}
-
-export function scenceLimitCancel (caseName, type, slotId) {
- return new Promise((resolve, reject) => {
- console.log(`${caseName} scenceLimitCancel type:${type}`);
- call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
- type,
- mode:RESTRICTION_MODE_DEACTIVATION,
- password:RIGHT_PASSWORD,
- })
- .then(data => {
- console.log(`${caseName} scenceLimitCancel success, data:${toString(data)}`);
- resolve(data);
- })
- .catch((error) => {
- console.log(`${caseName} scenceLimitCancel error,error:${toString(error)}`);
- reject(error);
- });
- });
-}
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {RIGHT_PASSWORD, DEFAULT_SLOT_ID, RESTRICTION_MODE_DEACTIVATION} from './Const.js';
+import {toString} from './ApiToPromise.js';
+import call from '@ohos.telephony.call';
+
+// limit call scence
+export function scenceLimitCalling (caseName, type, mode, slotId) {
+ return new Promise((resolve, reject) => {
+ console.log(`${caseName} scenceLimitCalling type:${type},mode:${mode}`);
+ call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
+ type,
+ mode,
+ password:RIGHT_PASSWORD,
+ })
+ .then(data => {
+ console.log(`${caseName} setCallRestriction success, data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} setCallRestriction error,error:${toString(error)}`);
+ reject(error);
+ });
+ });
+}
+
+export function scenceLimitCancel (caseName, type, slotId) {
+ return new Promise((resolve, reject) => {
+ console.log(`${caseName} scenceLimitCancel type:${type}`);
+ call.setCallRestriction(slotId ? slotId : DEFAULT_SLOT_ID, {
+ type,
+ mode:RESTRICTION_MODE_DEACTIVATION,
+ password:RIGHT_PASSWORD,
+ })
+ .then(data => {
+ console.log(`${caseName} scenceLimitCancel success, data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} scenceLimitCancel error,error:${toString(error)}`);
+ reject(error);
+ });
+ });
+}
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceTransfer.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceTransfer.js
similarity index 97%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceTransfer.js
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceTransfer.js
index 41cfdbaf57b4df9f3ca1a315b8ca489f813b1e81..e07d2220e8ec08aaccc04e9be7337d0bc5ffdd57 100644
--- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/lib/ScenceTransfer.js
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/lib/ScenceTransfer.js
@@ -1,48 +1,48 @@
-/**
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import call from '@ohos.telephony.call';
-import {toString} from './ApiToPromise.js';
-export function scenceTransferCalling (caseName, settingType, type, phoneNumber) {
- return new Promise((resolve, reject) => {
- call.setCallTransfer(0, {
- settingType,
- type,
- phoneNumber,
- })
- .then(data => {
- console.log(`${caseName} scenceTransferCalling success,data:${toString(data)}`);
- resolve(data);
- })
- .catch((error) => {
- console.log(`${caseName} scenceTransferCalling error,error:${toString(error)}`);
- reject(error);
- });
- });
-}
-
-export function scenceTransferCancel (caseName) {
- return new Promise((resolve, reject) => {
- call.dial('##002#')
- .then(data => {
- console.log(`${caseName} scenceTransferCancel success,data:${toString(data)}`);
- resolve(data);
- })
- .catch((error) => {
- console.log(`${caseName} scenceTransferCancel error,error${toString(error)}`);
- reject(error);
- });
- });
-}
-
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import call from '@ohos.telephony.call';
+import {toString} from './ApiToPromise.js';
+export function scenceTransferCalling (caseName, settingType, type, phoneNumber) {
+ return new Promise((resolve, reject) => {
+ call.setCallTransfer(0, {
+ settingType,
+ type,
+ phoneNumber,
+ })
+ .then(data => {
+ console.log(`${caseName} scenceTransferCalling success,data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} scenceTransferCalling error,error:${toString(error)}`);
+ reject(error);
+ });
+ });
+}
+
+export function scenceTransferCancel (caseName) {
+ return new Promise((resolve, reject) => {
+ call.dial('##002#')
+ .then(data => {
+ console.log(`${caseName} scenceTransferCancel success,data:${toString(data)}`);
+ resolve(data);
+ })
+ .catch((error) => {
+ console.log(`${caseName} scenceTransferCancel error,error${toString(error)}`);
+ reject(error);
+ });
+ });
+}
+
diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/resources/base/element/string.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..37616f87511546d3e002782ef19ac7c0e014d2ee
--- /dev/null
+++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/resources/base/media/icon.png
similarity index 100%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/resources/base/media/icon.png
rename to telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/resources/base/media/icon.png
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/BUILD.gn b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/BUILD.gn
index d71d00f31b9a128cc1c84393805c1c6fcbb7ac69..0d2efeb3ef84bf377b875670bc2c937c36894944 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/BUILD.gn
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/BUILD.gn
@@ -1,31 +1,33 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//test/xts/tools/build/suite.gni")
-
-ohos_js_hap_suite("ActsCellularDataAbnormalTest") {
- hap_profile = "./entry/src/main/config.json"
- deps = [
- ":hjs_demo_js_assets",
- ":hjs_demo_resources",
- ]
- certificate_profile = "./signature/openharmony_sx.p7b"
- hap_name = "ActsCellularDataAbnormalTest"
-}
-ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
-}
-ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
-}
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsCellularDataAbnormalTest") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsCellularDataAbnormalTest"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/Test.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/Test.json
index d7145f5da9e929ba72c326bb87194e8e8f9b318a..450767c2d9a7d3780a196334baca51ab61cdbe51 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/Test.json
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/Test.json
@@ -1,18 +1,20 @@
-{
- "description": "Configuration for callmanager Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "1800000",
- "package": "com.ohos.cellulardata",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "$module.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
+{
+ "description": "Configuration for callmanager Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "1800000",
+ "bundle-name": "com.ohos.cellulardata",
+ "package-name": "com.ohos.cellulardata",
+ "shell-timeout": "1800000",
+ "testcase-timeout": "30000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "$module.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 359c05368eaa43e301bc83ff7080b351f969e715..0000000000000000000000000000000000000000
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "CallManager"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/resources/base/media/icon.png and /dev/null differ
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/element/string.json
deleted file mode 100644
index 359c05368eaa43e301bc83ff7080b351f969e715..0000000000000000000000000000000000000000
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "CallManager"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/media/icon.png
deleted file mode 100644
index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000
Binary files a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/resources/base/media/icon.png and /dev/null differ
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/config.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json
similarity index 67%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/config.json
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json
index 3689150af7e819b9ac325d2158c5268cfc438512..32eb239cfca62f312714ba626538081b0291d4ef 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/config.json
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json
@@ -1,107 +1,140 @@
-{
- "app": {
- "bundleName": "com.ohos.cellulardata",
- "vendor": "ohos",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Release"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.ohos.cellulardata",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.ohos.cellulardata.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.LOCATION",
- "reason": "need use ohos.permission.LOCATION"
- },
- {
- "name":"ohos.permission.SET_TELEPHONY_STATE",
- "reason":"need use ohos.permission.SET_TELEPHONY_STATE"
- },
- {
- "name":"ohos.permission.GET_TELEPHONY_STATE",
- "reason":"need use ohos.permission.GET_TELEPHONY_STATE"
- },
- {
- "name":"ohos.permission.PLACE_CALL",
- "reason":"need use ohos.permission.PLACE_CALL"
- },
- {
- "name":"ohos.permission.READ_CONTACTS",
- "reason":"need use ohos.permission.READ_CONTACTS"
- },
- {
- "name":"ohos.permission.WRITE_CONTACTS",
- "reason":"need use ohos.permission.WRITE_CONTACTS"
- },
- {
- "name":"ohos.permission.SEND_MESSAGES",
- "reason":"need use ohos.permission.SEND_MESSAGES"
- },
- {
- "name":"ohos.permission.RECEIVE_SMS",
- "reason":"need use ohos.permission.RECEIVE_SMS"
- },
- {
- "name":"ohos.permission.READ_CALL_LOG",
- "reason":"need use ohos.permission.READ_CALL_LOG"
- },
- {
- "name":"ohos.permission.GET_NETWORK_INFO",
- "reason":"need use ohos.permission.GET_NETWORK_INFO"
- },
- {
- "name":"ohos.permission.INTERNET",
- "reason":"need use ohos.permission.INTERNET"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
-}
\ No newline at end of file
+{
+ "app": {
+ "bundleName": "com.ohos.cellulardata",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.cellulardata",
+ "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.LOCATION",
+ "reason": "need use ohos.permission.LOCATION"
+ },
+ {
+ "name":"ohos.permission.SET_TELEPHONY_STATE",
+ "reason":"need use ohos.permission.SET_TELEPHONY_STATE"
+ },
+ {
+ "name":"ohos.permission.GET_TELEPHONY_STATE",
+ "reason":"need use ohos.permission.GET_TELEPHONY_STATE"
+ },
+ {
+ "name":"ohos.permission.PLACE_CALL",
+ "reason":"need use ohos.permission.PLACE_CALL"
+ },
+ {
+ "name":"ohos.permission.READ_CONTACTS",
+ "reason":"need use ohos.permission.READ_CONTACTS"
+ },
+ {
+ "name":"ohos.permission.WRITE_CONTACTS",
+ "reason":"need use ohos.permission.WRITE_CONTACTS"
+ },
+ {
+ "name":"ohos.permission.SEND_MESSAGES",
+ "reason":"need use ohos.permission.SEND_MESSAGES"
+ },
+ {
+ "name":"ohos.permission.RECEIVE_SMS",
+ "reason":"need use ohos.permission.RECEIVE_SMS"
+ },
+ {
+ "name":"ohos.permission.READ_CALL_LOG",
+ "reason":"need use ohos.permission.READ_CALL_LOG"
+ },
+ {
+ "name":"ohos.permission.GET_NETWORK_INFO",
+ "reason":"need use ohos.permission.GET_NETWORK_INFO"
+ },
+ {
+ "name":"ohos.permission.INTERNET",
+ "reason":"need use ohos.permission.INTERNET"
+ }
+ ],
+ "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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/app.js
similarity index 50%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.js
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/app.js
index 8d813e8910bc9335e67ded6a4a2d4f45433e9d82..7fc4a5ba1276480e709ac835fd875458de66cee1 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.js
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/app.js
@@ -1,47 +1,33 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import file from '@system.file'
-import app from '@system.app'
-import device from '@system.device'
-import router from '@system.router'
-import {Core, ExpectExtend} from 'deccjsunit/index'
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish!')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- this.timeout = 30000
- configService.setConfig(this)
- require('../../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
\ 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+import file from '@system.file'
+import app from '@system.app'
+import device from '@system.device'
+import router from '@system.router'
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/i18n/en-US.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/i18n/zh-CN.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.css
similarity index 93%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.css
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.css
index 6fda792753f2e15f22b529c7b90a82185b2770bf..5c52a87a04f583e9d5f4db1dd40d4eafdb9b6aeb 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/pages/index/index.css
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.hml b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e42e400040bf303042d2b49a083870ed6a268f1c
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish!')
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/app.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/app.js
similarity index 91%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/app.js
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/app.js
index f6cc8926d94f6e4c3803ae8a7be2f5f08c0f78b5..e64117c268be3c6776d11168032484d7b3324751 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/default/app.js
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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('TestApplication onCreate');
- },
- onDestroy() {
- console.info('TestApplication 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('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
+
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/i18n/en-US.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/i18n/zh-CN.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js
similarity index 95%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js
index 2e76b7d7758ca45e36e83869e0977a8ab19b46cb..019dd98b049bbca1e2501fce6f3625f8ba94e1a0 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js
@@ -1,205 +1,206 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import cellular from "@ohos.telephony.data";
-import { describe, it, expect } from "deccjsunit/index";
-
-describe("ActsCellularDataAbnormalTest", function () {
- const ERR_SLOT_ID = 3;
-
- /*
- * @tc.number Telephony_CellularData_isCellularDataEnabled_Async_0100
- * @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
- * The result is true
- * @tc.desc Function test
- */
- it("Telephony_CellularData_isCellularDataEnabled_Async_0100", 0, async function (done) {
- cellular.isCellularDataEnabled((err, data) => {
- if (err) {
- expect().assertFail();
- console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 fail");
- done();
- return;
- }
- console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 finish");
- done();
- })
- })
-
- /*
- * @tc.number Telephony_CellularData_getCellularDataState_Async_0100
- * @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
- * and get the result 1 or 2
- * @tc.desc Function test
- */
- it("Telephony_CellularData_getCellularDataState_Async_0100", 0, async function (done) {
- cellular.getCellularDataState((err, data) => {
- if (err) {
- expect().assertFail();
- console.log("Telephony_CellularData_getCellularDataState_Async_0100 fail");
- done();
- return;
- }
- console.log("Telephony_CellularData_getCellularDataState_Async_0100 finish");
- done();
- })
- })
-
- /*
- * @tc.number Telephony_CellularData_getCellularDataFlowType_Async_0100
- * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
- * verify that the callback value is within the enumeration value range
- * @tc.desc Function test
- */
- it("Telephony_CellularData_getCellularDataFlowType_Async_0100", 0, async function (done) {
- cellular.getCellularDataFlowType((err, data) => {
- if (err) {
- expect().assertFail();
- console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 fail");
- done();
- return;
- }
- console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 finish");
- done();
- })
- })
-
- /*
- * @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200
- * @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
- * results
- * @tc.desc Function test
- */
- it("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200", 0, async function (done) {
- cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID, (err) => {
- if (err) {
- console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 finish");
- done();
- return;
- }
- expect().assertFail();
- console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 fail");
- done();
- })
- })
-
- /*
- * @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
- * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
- * @tc.desc Function test
- */
- it("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
- cellular.getDefaultCellularDataSlotId((err) => {
- if (!err) {
- expect(true).assertTrue();
- console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500 finish");
- done();
- } else {
- console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500 finish");
- done();
- }
- })
- })
-
-
- /*
- * @tc.number Telephony_CellularData_isCellularDataEnabled_Promise_0100
- * @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
- * The result is true
- * @tc.desc Function test
- */
- it("Telephony_CellularData_isCellularDataEnabled_Promise_0100", 0, async function (done) {
- try {
- await cellular.isCellularDataEnabled();
- console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 finish");
- done();
- } catch (err) {
- expect().assertFail();
- console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 fail");
- done();
- }
- })
-
- /*
- * @tc.number Telephony_CellularData_getCellularDataState_Promise_0100
- * @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
- * and get the result 1 or 2
- * @tc.desc Function test
- */
- it("Telephony_CellularData_getCellularDataState_Promise_0100", 0, async function (done) {
- try {
- await cellular.getCellularDataState();
- console.log("Telephony_CellularData_getCellularDataState_Promise_0100 finish");
- done();
- } catch (err) {
- expect().assertFail();
- console.log("Telephony_CellularData_getCellularDataState_Promise_0100 fail");
- done();
- }
- })
-
- /*
- * @tc.number Telephony_CellularData_getCellularDataFlowType_Promise_0100
- * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
- * verify that the callback value is within the enumeration value range
- * @tc.desc Function test
- */
- it("Telephony_CellularData_getCellularDataFlowType_Promise_0100", 0, async function (done) {
- try {
- await cellular.getCellularDataFlowType();
- console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 finish");
- done();
- } catch (err) {
- expect().assertFail();
- console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 fail");
- done();
- }
- })
-
- /*
- * @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200
- * @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
- * results
- * @tc.desc Function test
- */
- it("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200", 0, async function (done) {
- try {
- await cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID);
- expect().assertFail();
- console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 fail");
- done();
- } catch (err) {
- console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 finish");
- done();
- }
- })
-
- /*
- * @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
- * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
- * @tc.desc Function test
- */
- it("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
- try {
- await cellular.getDefaultCellularDataSlotId();
- console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish");
- done();
- } catch (err) {
- expect(true).assertTrue();
- console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish");
- 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 cellular from "@ohos.telephony.data";
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsCellularDataAbnormalTest() {
+describe("ActsCellularDataAbnormalTest", function () {
+ const ERR_SLOT_ID = 3;
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataEnabled_Async_0100
+ * @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
+ * The result is true
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataEnabled_Async_0100", 0, async function (done) {
+ cellular.isCellularDataEnabled((err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_isCellularDataEnabled_Async_0100 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataState_Async_0100
+ * @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
+ * and get the result 1 or 2
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataState_Async_0100", 0, async function (done) {
+ cellular.getCellularDataState((err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataState_Async_0100 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_getCellularDataState_Async_0100 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataFlowType_Async_0100
+ * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
+ * verify that the callback value is within the enumeration value range
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataFlowType_Async_0100", 0, async function (done) {
+ cellular.getCellularDataFlowType((err, data) => {
+ if (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 fail");
+ done();
+ return;
+ }
+ console.log("Telephony_CellularData_getCellularDataFlowType_Async_0100 finish");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200
+ * @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
+ * results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200", 0, async function (done) {
+ cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID, (err) => {
+ if (err) {
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 finish");
+ done();
+ return;
+ }
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Async_0200 fail");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
+ * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500", 0, async function (done) {
+ cellular.getDefaultCellularDataSlotId((err) => {
+ if (!err) {
+ expect(true).assertTrue();
+ console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500 finish");
+ done();
+ } else {
+ console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500 finish");
+ done();
+ }
+ })
+ })
+
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataEnabled_Promise_0100
+ * @tc.name Call the enableCellularData interface and then call the isCellularDataEnabled interface.
+ * The result is true
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataEnabled_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.isCellularDataEnabled();
+ console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataEnabled_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataState_Promise_0100
+ * @tc.name Call the enableCellularData interface, call the getCellularDataState interface,
+ * and get the result 1 or 2
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataState_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.getCellularDataState();
+ console.log("Telephony_CellularData_getCellularDataState_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataState_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getCellularDataFlowType_Promise_0100
+ * @tc.name When cellular data is turned on, call getCellularDataFlowType() to get the data stream type and
+ * verify that the callback value is within the enumeration value range
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getCellularDataFlowType_Promise_0100", 0, async function (done) {
+ try {
+ await cellular.getCellularDataFlowType();
+ console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 finish");
+ done();
+ } catch (err) {
+ expect().assertFail();
+ console.log("Telephony_CellularData_getCellularDataFlowType_Promise_0100 fail");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200
+ * @tc.name Call isCellularDataRoamingEnabled, set the slotId to error values (3), to check the correction
+ * results
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200", 0, async function (done) {
+ try {
+ await cellular.isCellularDataRoamingEnabled(ERR_SLOT_ID);
+ expect().assertFail();
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 fail");
+ done();
+ } catch (err) {
+ console.log("Telephony_CellularData_isCellularDataRoamingEnabled_Promise_0200 finish");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
+ * @tc.name Call getDefaultCellularDataSlotId() interface and verify whether the setting failed (Async)
+ * @tc.desc Function test
+ */
+ it("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500", 0, async function (done) {
+ try {
+ await cellular.getDefaultCellularDataSlotId();
+ console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish");
+ done();
+ } catch (err) {
+ expect(true).assertTrue();
+ console.info("Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish");
+ done();
+ }
+ })
+})
+}
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/List.test.js
similarity index 78%
rename from telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/List.test.js
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/List.test.js
index 90fc092365568c08ee58d96ad6c57accfd2e306c..e74414a6026cb23f391d0bb6a1d258d386e61515 100644
--- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/List.test.js
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/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('./CellularDataAbnorma.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 ActsCellularDataAbnormalTest from './CellularDataAbnorma.test.js'
+
+export default function testsuite() {
+ ActsCellularDataAbnormalTest()
+}
\ No newline at end of file
diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/resources/base/element/string.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..7e93f36cb40d563e9070f5ab873c9184ee4b9b15
--- /dev/null
+++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CallManager"
+ },
+ {
+ "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/telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/resources/base/media/icon.png
similarity index 100%
rename from telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/resources/base/media/icon.png
rename to telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/resources/base/media/icon.png